torch.autograd.forward_ad.make_dual
- torch.autograd.forward_ad.make_dual(tensor, tangent, *, level=None)
Associate a tensor value with its tangent to create a “dual tensor” for forward AD gradient computation.
The result is a new tensor aliased to
tensorwithtangentembedded as an attribute as-is if it has the same storage layout or copied otherwise. The tangent attribute can be recovered with .