I want to construct sobolev network for 3D input regression
In TensorFlow, the gradients of neural network model can be computed using tf.gradient
like:
dfdx,dfdy,dfdz = tf.gradients(pred,[x,y,z])
Let M be a torch neural network with 5 layers. If X is a set of (x,y,z) (3dim data) and M.forward(X) is a 1 dim output
How can I compute like gradient of M.forward(X) with respect to X? Something like:
tf.gradient(M.forward(X),X)