Hello! I’ve been trying to implement QAOA using Strawberry fields to optimize the function
f(x) = (x-3)**2 and the code shows an error while computing the gradients using TensorFlow. The following is the main snippet of the code.!
with U_B and U_C and loss function is given by
and the error is
As far as I understand, this error is due to the fact that there is no connection between the variables and the loss function but I can’t find a way to get over it. Any help is much appreciated! Thanks in advance!