pub enum TensorDataRef<'a> {
Raw(Bytes),
Strings(&'a [Bytes]),
F32(&'a [f32]),
F64(&'a [f64]),
I32(&'a [i32]),
I64(&'a [i64]),
U64(&'a [u64]),
}Expand description
Zero-copy tensor data reference
Variants§
Raw(Bytes)
Strings(&'a [Bytes])
F32(&'a [f32])
F64(&'a [f64])
I32(&'a [i32])
I64(&'a [i64])
U64(&'a [u64])
Implementations§
Source§impl<'a> TensorDataRef<'a>
impl<'a> TensorDataRef<'a>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Total byte length across all variants
For Strings, returns the sum of all string element byte lengths.
If all Strings are empty, returns 0.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if data contains no elements
For Raw and numeric variants, equivalent to len() == 0.
For Strings, checks if the slice of string elements is empty.
Trait Implementations§
Source§impl<'a> Clone for TensorDataRef<'a>
impl<'a> Clone for TensorDataRef<'a>
Source§fn clone(&self) -> TensorDataRef<'a>
fn clone(&self) -> TensorDataRef<'a>
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 moreAuto Trait Implementations§
impl<'a> !Freeze for TensorDataRef<'a>
impl<'a> RefUnwindSafe for TensorDataRef<'a>
impl<'a> Send for TensorDataRef<'a>
impl<'a> Sync for TensorDataRef<'a>
impl<'a> Unpin for TensorDataRef<'a>
impl<'a> UnsafeUnpin for TensorDataRef<'a>
impl<'a> UnwindSafe for TensorDataRef<'a>
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