Does autograd differentiate with respect to the linspace arguments
PyTorch Forums
Does autograd differentiate with respect to the linspace arguments
The following program demonstrates that autograd does not differentiate with respect the argument to linspace: import torch start = torch.tensor( 0.0, requires_grad=True ) end = torch.tensor( 1.0, requires_grad=True ) steps = torch.tensor( 2 ) # x = torch.linspace(start, end, steps, requires_grad=True) y = torch.stack( (start, end) ) # print( "x = ", x ) print( "y = ", y ) # x[0].backward() print( "x[0].backward: start.grad = ", start.grad ) print( "x[0].backward: end.grad = ", end....
0 comments
No comments yet.