0
$\begingroup$

I am trying to use qml to do physics informed quantum machine learning within Tensorflow. I know with TF, to get derivatives of the network's inputs (df/dx, for example), you can use with tf.GradientTape() as tape and define a function representing a partial differential equation as:

@tf.function
  def physic_loss(t, x):
    u0 = u(t, x)
    u_t = tf.gradients(u0, t)[0]
    u_x = tf.gradients(u0, x)[0]
    u_xx = tf.gradients(u_x, x)[0]
    F = u_t + u0*u_x - (0.01/np.pi)*u_xx
    return tf.reduce_mean(tf.square(F))

It doesn’t seem like the qnode components are contributing to this loss. My guess is that I need to use quantum grad tape somehow to get derivatives w.r.t x and t. Any guidance would be great!!!

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.