Hi,
You don’t need y to require gradients unless you want them. Your fc_loc should have some parameters that require gradients and that will be enough.
This code looks ok to me.
You can use from torch.autograd.gradcheck import gradcheck to check if the gradients computed by your Interp1d functions match finite difference.