pub struct StridedTensor<T> {
pub shape: Vec<usize>,
pub stride: Vec<usize>,
pub data: Vec<T>,
}Expand description
Tensor with explicit stride for non-contiguous layouts
Binary format: [q][dim_count][type][shape...][stride...][data...]
- Supports arbitrary memory layouts (column-major, slices, views)
- Stores explicit stride information
- Use for: slices, transposed views, column-major matrices
§Examples
use vsf::StridedTensor;
// Column-major 1000×1000 matrix
let mat = StridedTensor::new(
vec![1000, 1000],
vec![1, 1000], // Column-major stride
vec![0.0f64; 1_000_000]
);
// 2D slice with custom stride
let slice = StridedTensor::new(
vec![100, 50],
vec![200, 2], // Every other element
vec![0u8; 10_000]
);Fields§
§shape: Vec<usize>§stride: Vec<usize>§data: Vec<T>Implementations§
Trait Implementations§
Source§impl<T: Clone> Clone for StridedTensor<T>
impl<T: Clone> Clone for StridedTensor<T>
Source§fn clone(&self) -> StridedTensor<T>
fn clone(&self) -> StridedTensor<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for StridedTensor<T>
impl<T: Debug> Debug for StridedTensor<T>
Source§impl<T: PartialEq> PartialEq for StridedTensor<T>
impl<T: PartialEq> PartialEq for StridedTensor<T>
Source§fn eq(&self, other: &StridedTensor<T>) -> bool
fn eq(&self, other: &StridedTensor<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T> StructuralPartialEq for StridedTensor<T>
Auto Trait Implementations§
impl<T> Freeze for StridedTensor<T>
impl<T> RefUnwindSafe for StridedTensor<T>where
T: RefUnwindSafe,
impl<T> Send for StridedTensor<T>where
T: Send,
impl<T> Sync for StridedTensor<T>where
T: Sync,
impl<T> Unpin for StridedTensor<T>where
T: Unpin,
impl<T> UnsafeUnpin for StridedTensor<T>
impl<T> UnwindSafe for StridedTensor<T>where
T: UnwindSafe,
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