```
def gen_ansatz(theta_g, x=None):
#Reshape theta so params are easier to access
#theta_g = theta_g.reshape(NUM_QUBITS, NUM_LAYERS, PARAMS_PER_LAYER)
for i in range(NUM_LAYERS):
# Hadamard
for q in range(NUM_QUBITS):
qml.Hadamard(wires=q)
# RX RZ
for q in range(NUM_QUBITS):
qml.RX(x[q // 2] * theta_g[q, i, 0], wires=q)
qml.RZ(x[q // 2] * theta_g[q, i, 1], wires=q)
# Entanglement
for q in range(NUM_QUBITS-1):
qml.CNOT(wires=[q, q + 1])
```

In my above quantum circuit, I am getting the following error during gradient calculation:

unsupported operand type for /: ‘Variable’ and ‘int’

I assume this comes from my multiplication of x and theta_g within the RX and RZ. As I understand it, since x is a keyword argument, it should not be differentiated. Can anyone point out my issue?