pub struct Tensor { /* private fields */ }Implementations§
Source§impl Tensor
impl Tensor
pub fn zeros(shape: &[usize]) -> Self
pub fn ones(shape: &[usize]) -> Self
pub fn from_vec(shape: &[usize], data: Vec<f64>) -> Self
pub fn from_fn(shape: &[usize], f: impl Fn(&[usize]) -> f64) -> Self
pub fn scalar(val: f64) -> Self
pub fn identity(n: usize) -> Self
pub fn shape(&self) -> &[usize]
pub fn rank(&self) -> usize
pub fn size(&self) -> usize
pub fn data(&self) -> &[f64]
pub fn get(&self, indices: &[usize]) -> f64
pub fn set(&mut self, indices: &[usize], value: f64)
pub fn scale(&self, s: f64) -> Self
pub fn map(&self, f: impl Fn(f64) -> f64) -> Self
pub fn elementwise(&self, other: &Tensor, f: impl Fn(f64, f64) -> f64) -> Self
pub fn sum(&self) -> f64
pub fn max(&self) -> f64
pub fn min(&self) -> f64
pub fn frobenius_norm(&self) -> f64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tensor
impl RefUnwindSafe for Tensor
impl Send for Tensor
impl Sync for Tensor
impl Unpin for Tensor
impl UnsafeUnpin for Tensor
impl UnwindSafe for Tensor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more