Cvqnn_layers_all

Hi all. I would like to use cvqnn_layers_all to convert parameters to torch tensor
inits = torch.tensor(cvqnn_layers_all(L, M, seed=0), dtype=torch.float64)

however when I wanted to check the documentation it says that page for cvqnn_layers_all does not exist anymore. Can you suggest any method instead of cvqnn_layers_all to convert to tensor?

Thank you,
Aigerim

Hi @Aigerim,

The following code from the CVNeuralNetLayers docs should help you.

shapes = CVNeuralNetLayers.shape(n_layers=2, n_wires=2)
weights = [np.random.random(shape) for shape in shapes]

def circuit():
  CVNeuralNetLayers(*weights, wires=[0, 1])
  return qml.expval(qml.X(0))

Please let me know if this solves your problem!

Dear Catalina,
Thank you very much!
My problem is solved.

I’m glad!

Enjoy using PennyLane!