pub struct Tensor { /* private fields */ }Expand description
Dense tensor with arbitrary dimensions.
Row-major (C-order) storage. Shape [d0, d1, ..., dk] means
element [i0, i1, ..., ik] is at offset i0*stride[0] + i1*stride[1] + ....
Implementations§
Source§impl Tensor
impl Tensor
Sourcepub fn new(shape: Vec<usize>, data: Vec<f32>) -> Result<Self, TensorError>
pub fn new(shape: Vec<usize>, data: Vec<f32>) -> Result<Self, TensorError>
Create a new tensor with the given shape and data.
§Errors
Returns error if data length doesn’t match shape product.
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