Open dgcnz opened 5 months ago
Minimal code for reproduction:
x = torch.tensor(1.0, requires_grad=True)
input = x * torch.randn(1, 3, 2, 2, 2, requires_grad=True)
grid = torch.randn(1, 3, 2, 2, 3, requires_grad=True)
g = torch.grid_sampler_3d(input, grid, 0, 0, True)
l = g.sum()
first_derivative = torch.autograd.grad(l, x, create_graph=True)[0]
second_derivative = torch.autograd.grad(first_derivative, x)[0]