Add a `dual2real()` function
adtzlr opened this issue · comments
How should this function / method be named?
- derive
- derivative
- variation
- dual2real
- downstairs
def dual2real(A, like=None):
"Return a Tensor with old-dual data as new-real values."
ndual = like.ndual - len(like.shape)
return tr.Tensor(
x=A.δx,
δx=A.Δδx,
Δx=A.Δδx,
ndual=ndual,
ntrax=A.ntrax - ndual
)