pub trait ArithmeticOps {
Show 14 methods
// Required methods
fn add(&self, other: &Tensor) -> Result<Tensor>;
fn sub(&self, other: &Tensor) -> Result<Tensor>;
fn mul(&self, other: &Tensor) -> Result<Tensor>;
fn div(&self, other: &Tensor) -> Result<Tensor>;
fn add_scalar(&self, scalar: f32) -> Result<Tensor>;
fn sub_scalar(&self, scalar: f32) -> Result<Tensor>;
fn mul_scalar(&self, scalar: f32) -> Result<Tensor>;
fn div_scalar(&self, scalar: f32) -> Result<Tensor>;
fn neg(&self) -> Result<Tensor>;
fn abs(&self) -> Result<Tensor>;
fn pow(&self, exponent: f32) -> Result<Tensor>;
fn sqrt(&self) -> Result<Tensor>;
fn exp(&self) -> Result<Tensor>;
fn log(&self) -> Result<Tensor>;
}Expand description
Trait for arithmetic operations on tensors.
Required Methods§
Sourcefn add_scalar(&self, scalar: f32) -> Result<Tensor>
fn add_scalar(&self, scalar: f32) -> Result<Tensor>
Add a scalar to all elements.
Sourcefn sub_scalar(&self, scalar: f32) -> Result<Tensor>
fn sub_scalar(&self, scalar: f32) -> Result<Tensor>
Subtract a scalar from all elements.
Sourcefn mul_scalar(&self, scalar: f32) -> Result<Tensor>
fn mul_scalar(&self, scalar: f32) -> Result<Tensor>
Multiply all elements by a scalar.
Sourcefn div_scalar(&self, scalar: f32) -> Result<Tensor>
fn div_scalar(&self, scalar: f32) -> Result<Tensor>
Divide all elements by a scalar.