Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to acess ‘simulon_gausian’ in pennylane #113

Open
HeyPhiS opened this issue Jul 26, 2022 · 1 comment
Open

Error trying to acess ‘simulon_gausian’ in pennylane #113

HeyPhiS opened this issue Jul 26, 2022 · 1 comment

Comments

@HeyPhiS
Copy link

HeyPhiS commented Jul 26, 2022


Issue description

I am trying to run a circuit on Xanadu’s " simulon_gaussian" backend via the PennyLane-Strawberry Fields Plugin. Unfortunately, when trying to initialise the device with

  import pennylane as qml

  dev = qml.device('strawberryfields.remote', backend='simulon_gaussian', wires=['0','1','2'], cutoff_dim=10)

I receive in return the error message
ValueError: Device has a fixed number of {'pnr_max': 20, 'homodyne_max': 1000, 'heterodyne_max': 1000} modes and cannot be created with 3 wires.

When I leave out the wires keyword argument I instead receive the error message
TypeError: ‘dict’ object cannot be interpreted as an integer.

System information

  • Operating system:
    Windows 10

  • PennyLane-SF version:
    PennyLane : 0.24.0
    PennyLane-SF : 0.20.1
    StrawberryFields : 0.23.0

  • Python version:
    Python : 3.9.13

  • NumPy and SciPy versions:
    Numpy : 1.21.6
    Scipy : 1.8.1

  • Installation method:
    everything via pip

Source code and tracebacks

When I look at the source code


    self.backend = backend
    self.cutoff = cutoff_dim
    eng = sf.RemoteEngine(self.backend)

    self.num_wires = eng.device.modes

    if wires is None:
        # infer the number of modes from the device specs
        # and use consecutive integer wire labels
        wires = range(self.num_wires)

    if isinstance(wires, int):
        raise ValueError(
            f"Device has a fixed number of {self.num_wires} modes. The wires argument can "
            f"only be used to specify an iterable of wire labels."
        )

    if self.num_wires != len(wires):
        raise ValueError(
            f"Device has a fixed number of {self.num_wires} modes and "
            f"cannot be created with {len(wires)} wires."
        )

the problem seems to me that sf.RemoteEngine( 'simulon_gaussian').device.modes returns the dictionary {'pnr_max': 20, 'homodyne_max': 1000, 'heterodyne_max': 1000} while pennylane expects an integer.

To me, this looks very much like a bug. However, I don't know if the problem is on the side of PennyLane or Strafberryfields.

@CatalinaAlbornoz
Copy link

Linking the forum post where this issue was first reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants