# tensorplay.autograd.forward_ad.make_dual Source: https://www.tensorplay.cn/docs/generated/tensorplay.autograd.forward_ad.make_dual.html ```python tensorplay.autograd.forward_ad.make_dual(tensor: Tensor, tangent: Tensor, *, level: int | None = None) → Tensor ``` Associates a tensor value with its tangent to create a “dual tensor”. The result is a new tensor aliased to tensor with tangent attached as its forward gradient. The tangent can be recovered with [unpack_dual()](/docs/generated/tensorplay.autograd.forward_ad.unpack_dual.html#tensorplay.autograd.forward_ad.unpack_dual). Given a function f whose jacobian is J, this computes the Jacobian-vector product (jvp) between J and a given vector v: ``` >>> # xdoctest: +SKIP("Undefined variables") >>> with dual_level(): ... inp = make_dual(x, v) ... out = f(inp) ... y, jvp = unpack_dual(out) ```