[−][src]Function autograd::ops::grad_with_default
pub unsafe fn grad_with_default<T, A, B, C>(
ys: &[A],
xs: &[B],
ys_grads: &[C]
) -> Vec<Tensor<T>> where
T: Float,
A: AsRef<Tensor<T>>,
B: AsRef<Tensor<T>>,
C: AsRef<Tensor<T>>,
Computes gradients with ys
's already known gradients.
Almost same spec as grad's except that you can pass ys
s already known gradients.
If ys_grads
are tensors filled with 1s, this function should be replaced with grad.
NOTE: Please be careful to match ys_grads[i].shape
and ys[i].shape
,
otherwise undefined behavior would happen.
Arguments
ys
- Targets of differentiation.xs
- tensors with which differentiateys
.ys_grads
- Already known gradients ofys
.
Returns
Symbolic gradient tensors of xs
in the same order as xs
's.