pub struct Tensor {
pub data: Vec<f64>,
pub shape: Vec<usize>,
pub rows: usize,
pub cols: usize,
}Fields§
§data: Vec<f64>§shape: Vec<usize>§rows: usize§cols: usizeImplementations§
Source§impl Tensor
impl Tensor
pub fn new(data: Vec<f64>, shape: Vec<usize>) -> Result<Self, String>
pub fn new_2d(data: Vec<f64>, rows: usize, cols: usize) -> Result<Self, String>
pub fn zeros(shape: Vec<usize>) -> Self
pub fn ones(shape: Vec<usize>) -> Self
pub fn zeros2(rows: usize, cols: usize) -> Self
pub fn ones2(rows: usize, cols: usize) -> Self
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
pub fn get2(&self, row: usize, col: usize) -> Result<f64, String>
pub fn set2(&mut self, row: usize, col: usize, value: f64) -> Result<(), String>
pub fn scalar_to_tensor2(scalar: f64, rows: usize, cols: usize) -> Tensor
Trait Implementations§
impl StructuralPartialEq for Tensor
Auto Trait Implementations§
impl Freeze for Tensor
impl RefUnwindSafe for Tensor
impl Send for Tensor
impl Sync for Tensor
impl Unpin 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