Skip to main content

TensorStorage

Enum TensorStorage 

Source
pub enum TensorStorage {
    F32(Arc<Vec<f32>>),
    F64(Arc<Vec<f64>>),
    F64Inline4([f64; 4]),
    F16(Arc<Vec<Float16>>),
    BF16(Arc<Vec<BFloat16>>),
    QInt8(Arc<Vec<i8>>),
    QUInt8(Arc<Vec<u8>>),
    Complex64(Arc<Vec<Complex64>>),
    Complex128(Arc<Vec<Complex128>>),
}

Variants§

§

F32(Arc<Vec<f32>>)

§

F64(Arc<Vec<f64>>)

§

F64Inline4([f64; 4])

§

F16(Arc<Vec<Float16>>)

§

BF16(Arc<Vec<BFloat16>>)

§

QInt8(Arc<Vec<i8>>)

§

QUInt8(Arc<Vec<u8>>)

§

Complex64(Arc<Vec<Complex64>>)

§

Complex128(Arc<Vec<Complex128>>)

Implementations§

Source§

impl TensorStorage

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn dtype(&self) -> DType

Source

pub fn as_f64(&self) -> Option<&[f64]>

Source

pub fn as_f32(&self) -> Option<&[f32]>

Source

pub fn as_f16(&self) -> Option<&[Float16]>

Source

pub fn as_bf16(&self) -> Option<&[BFloat16]>

Source

pub fn as_qint8(&self) -> Option<&[i8]>

Source

pub fn as_quint8(&self) -> Option<&[u8]>

Source

pub fn as_complex64(&self) -> Option<&[Complex64]>

Source

pub fn as_complex128(&self) -> Option<&[Complex128]>

Source

pub fn to_f64_vec(&self) -> Vec<f64>

Convert storage to f64 values, promoting from any float type. Complex types extract the real part.

Source

pub fn to_f32_vec(&self) -> Vec<f32>

Convert storage to f32 values, promoting from half or demoting from f64. Complex types extract the real part.

Trait Implementations§

Source§

impl Clone for TensorStorage

Source§

fn clone(&self) -> TensorStorage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TensorStorage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TensorStorage

Source§

fn eq(&self, other: &TensorStorage) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TensorStorage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.