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.
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.
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
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
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.