Function dfdx::tensor_ops::sub
source · [−]pub fn sub<Lhs, Rhs>(lhs: Lhs, rhs: Rhs) -> Lhswhere
Lhs: Tensor<Dtype = f32>,
Rhs: Tensor<Dtype = f32, Array = Lhs::Array>,
Lhs::Tape: Merge<Rhs::Tape>,
Expand description
Element wise subtraction.
Example:
let a = tensor([[1.0, 2.0, 3.0], [-1.0, -2.0, -3.0]]);
let b = Tensor2D::ones();
let r = sub(a, b); // or `a - b`
assert_eq!(r.data(), &[[0.0, 1.0, 2.0], [-2.0, -3.0, -4.0]]);