How to define first order derivative of model output with respect to A SPECIFIC MODEL INPUT poinr

Hi Does anyone know if it is possible to define dy/dx at x = 0 in keras custom loss function? For solving 2nd order ODE with this boundary condition

I am not true if this is the correct definition: der = K.gradients(model.output, np.array([0]))[0] but this returns None, so it cannot work in the model training. Is there any way to define this?

Hi @Sam_Low

Welcome to the TensorFlow Forum!

Please share minimal reproducible code to replicate and understand the issue. You can also refer to the Auto Differentiation tutorial for more details on TF Gradient Tape functionality. Thank you!