pub trait TensorOps: TensorBase {
Show 18 methods
// Required methods
fn add(&self, other: &Self) -> Self;
fn sub(&self, other: &Self) -> Self;
fn mul(&self, other: &Self) -> Self;
fn div(&self, other: &Self) -> Self;
fn matmul(&self, other: &Self) -> Self;
fn transpose(&self, axes: Option<&[usize]>) -> Self;
fn sum(&self, axes: Option<&[usize]>) -> Self;
fn mean(&self, axes: Option<&[usize]>) -> Self;
fn mul_scalar(&self, scalar: f64) -> Self;
fn add_scalar(&self, scalar: f64) -> Self;
fn map<F>(&self, f: F) -> Self
where F: Fn(f64) -> f64 + Send + Sync;
fn reshape(&self, new_shape: &[usize]) -> Self;
fn slice(&self, axes: &[usize], ranges: &[Range<usize>]) -> Self;
fn concat(&self, other: &Self, axis: usize) -> Self;
fn max(&self) -> f64;
fn min(&self) -> f64;
fn norm(&self) -> f64;
fn normalize(&self) -> Self;
}Expand description
Tensor 操作 trait:定义数学运算
提供加法、乘法、矩阵乘法、转置等操作
Required Methods§
Sourcefn mul_scalar(&self, scalar: f64) -> Self
fn mul_scalar(&self, scalar: f64) -> Self
逐元素乘以标量
Sourcefn add_scalar(&self, scalar: f64) -> Self
fn add_scalar(&self, scalar: f64) -> Self
逐元素加上标量
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl TensorOps for DenseTensor
Available on crate feature
tensor only.