Hi , I am trying to use qml.GradientDescentOptimizer along with Templates as follows ,

```
from sklearn.datasets import load_iris
# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :] # we only take the first two features.
Y = iris.target
n_qubits = 4
dev = qml.device("default.qubit", wires=n_qubits)
@qml.qnode(dev)
def qnode(X,weights):
qml.templates.AngleEmbedding(X, wires=range(n_qubits))
qml.templates.StronglyEntanglingLayers(weights, wires=range(n_qubits))
return [qml.expval(qml.PauliZ(i)) for i in range(n_qubits)]
weights = np.array([0.1,0.2,0.3,0.4,0.5,0.6,0.1,0.2,0.3,0.4,0.5,0.6]).reshape(1,4,3)
def cost(x,weights):
return qnode(x,weights)
opt = qml.GradientDescentOptimizer(stepsize=0.1)
# set the number of steps
steps = 100
# set the initial parameter values
params = weights
for i in range(steps):
# update the circuit parameters
weights = opt.step(cost, weights)
if (i + 1) % 5 == 0:
print("Cost after step {:5d}: {: .7f}".format(i + 1, cost(params)))
print("Optimized rotation angles: {}".format(params))
```

The problem I have is that how should I be passing inputs and weights to the cost function ?

I was able to do the same with Keras layer since it allows me to pass weight_shapes and data was passed during model.fit(X,Y)