Skip to main content

ArithmeticOps

Trait ArithmeticOps 

Source
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§

Source

fn add(&self, other: &Tensor) -> Result<Tensor>

Element-wise addition with broadcasting.

Source

fn sub(&self, other: &Tensor) -> Result<Tensor>

Element-wise subtraction with broadcasting.

Source

fn mul(&self, other: &Tensor) -> Result<Tensor>

Element-wise multiplication with broadcasting.

Source

fn div(&self, other: &Tensor) -> Result<Tensor>

Element-wise division with broadcasting.

Source

fn add_scalar(&self, scalar: f32) -> Result<Tensor>

Add a scalar to all elements.

Source

fn sub_scalar(&self, scalar: f32) -> Result<Tensor>

Subtract a scalar from all elements.

Source

fn mul_scalar(&self, scalar: f32) -> Result<Tensor>

Multiply all elements by a scalar.

Source

fn div_scalar(&self, scalar: f32) -> Result<Tensor>

Divide all elements by a scalar.

Source

fn neg(&self) -> Result<Tensor>

Element-wise negation.

Source

fn abs(&self) -> Result<Tensor>

Element-wise absolute value.

Source

fn pow(&self, exponent: f32) -> Result<Tensor>

Element-wise power operation.

Source

fn sqrt(&self) -> Result<Tensor>

Element-wise square root.

Source

fn exp(&self) -> Result<Tensor>

Element-wise exponential.

Source

fn log(&self) -> Result<Tensor>

Element-wise natural logarithm.

Implementors§