qml icon indicating copy to clipboard operation
qml copied to clipboard

Update `tutorial_variational_classifier` to torch

Open KetpuntoG opened this issue 2 years ago • 0 comments

One of the tasks I am working on is to move some demos to torch or jax instead of autograd (from pennylane import numpy should not appear in the demo). The demo tutorial_variational_classifier is a demo that I have to change to torch but I have not managed to do it.

The problem I have I think is in the batching. The demo is divided into two examples, I have managed to make the first one work with a standard torch flow and by changing the statepreparation to

def statepreparation(x):
    qml.AngleEmbedding(np.pi * x, wires = [0,1,2,3], rotation = "X")

The reason for this is that it allows me to do batching and introduce it into the torch workflow. The second example is a very particular ansatz and I am failing to it the example torch-compatible.

KetpuntoG avatar Nov 01 '23 13:11 KetpuntoG