pub struct TensorMetadata {
pub size: usize,
pub shape: Vec<usize>,
pub dtype: String,
}Expand description
Metadata about a tensor source (without the actual tensor data).
Used for validation and introspection without requiring Python GIL.
Fields§
§size: usizeNumber of samples in the tensor (first dimension)
shape: Vec<usize>Shape of each sample (excluding batch dimension)
dtype: StringData type as string (e.g., “float32”, “float64”)
Implementations§
Source§impl TensorMetadata
impl TensorMetadata
Sourcepub fn new(size: usize, shape: Vec<usize>) -> Self
pub fn new(size: usize, shape: Vec<usize>) -> Self
Create metadata with default dtype (float32).
Sourcepub fn with_dtype(size: usize, shape: Vec<usize>, dtype: &str) -> Self
pub fn with_dtype(size: usize, shape: Vec<usize>, dtype: &str) -> Self
Create metadata with explicit dtype.
Sourcepub fn sample_numel(&self) -> usize
pub fn sample_numel(&self) -> usize
Total number of elements per sample.
Sourcepub fn full_shape(&self) -> Vec<usize>
pub fn full_shape(&self) -> Vec<usize>
Full shape including batch dimension.
Trait Implementations§
Source§impl Clone for TensorMetadata
impl Clone for TensorMetadata
Source§fn clone(&self) -> TensorMetadata
fn clone(&self) -> TensorMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TensorMetadata
impl RefUnwindSafe for TensorMetadata
impl Send for TensorMetadata
impl Sync for TensorMetadata
impl Unpin for TensorMetadata
impl UnsafeUnpin for TensorMetadata
impl UnwindSafe for TensorMetadata
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