Hi everyone, I couldn’t find which ansatz is the following circuit. Because I am trying to understand why to use Rotation, Squeezing, Displacement and Kerr. Can you help me? Thanx
def layer(v):
# Matrix multiplication of input layer
qml.Rotation(v[0], wires=0)
qml.Squeezing(v[1], 0.0, wires=0)
qml.Rotation(v[2], wires=0)
# Bias
qml.Displacement(v[3], 0.0, wires=0)
# Element-wise nonlinear transformation
qml.Kerr(v[4], wires=0)
@qml.qnode(dev)
def quantum_neural_net(var, x=None):
# Encode input x into quantum state
qml.Displacement(x, 0.0, wires=0)
# "layer" subcircuits
for v in var:
layer(v)
return qml.expval(qml.X(0))
In this case, we are looking to fitting a function with a quantum neural network. When fitting a function (any function) it is fundamental to keep the linear independence of your set of variables.
What we do in this definition of layer is incorporate rotations, exponentials (Squeezing), sum of some constant (Displacement) and Gaussians (Kerr). This forms a set of linear independent transformations.
You don’t need to follow this ansatz, though. But to fit a general function with a set of layers, the minimal structure for one layer should be like f(x)=a0+a1.x, a linear equation.
Please let me know if you have any additional questions.
PS: You can find more information here,