I'm trying to learn how to use PennyLane's CVNeuralNetLayers. I wrote this code below but I am not able to use the resulting state of the circuit generated by this layer. I looked for examples in the documentation but found nothing.
I already tried to change the device to "default.qubit" but a similar error occurs. Is it possible to visualize the resulting state of this layer? Should i change the pennylane device?
from pennylane.templates.layers import CVNeuralNetLayers
from pennylane import numpy as np
import pennylane as qml
dev = qml.device('lightning.qubit', wires=4)
n_layers = 1
n_wires = 4
shapes = CVNeuralNetLayers.shape(n_layers, n_wires)
weights = [np.random.random(shape) for shape in shapes]
@qml.qnode(dev)
def circuit(weights):
CVNeuralNetLayers(*weights, wires=[0, 1, 2, 3])
return qml.state()
print("\n\n", qml.draw(circuit, expansion_strategy="lightning")(weights))
ket = circuit(weights)
print("\nResulting State: ", ket)
The output is:
DeviceError: Gate Beamsplitter not supported on device lightning.qubit