Struct GTensorMetadata

Source
pub struct GTensorMetadata<const DIMS: usize> {
    pub typ: GType,
    pub op: ggml_op,
    pub shape: [usize; DIMS],
    pub len_bytes: usize,
    pub len_elements: usize,
    pub element_size: usize,
    pub ggml_ne: [u32; 4],
    pub ggml_nb: [u32; 4],
}
Expand description

Metadata associated with a GTensor.

Fields§

§typ: GType

The type of tensor.

§op: ggml_op

The associated GGML operation if available.

§shape: [usize; DIMS]

The shape of the tensor.

§len_bytes: usize

The length in bytes.

§len_elements: usize

The number of elements.

§element_size: usize

The size of an individual element.

Note: This may not be accurate for quantized types.

§ggml_ne: [u32; 4]§ggml_nb: [u32; 4]

Implementations§

Source§

impl<const DIMS: usize> GTensorMetadata<DIMS>
where Dim<DIMS>: DimValid,

Source

pub fn is_scalar(&self) -> bool

Source

pub fn is_vector(&self) -> bool

Source

pub fn is_matrix(&self) -> bool

Source

pub fn is_quantized(&self) -> bool

Source

pub fn can_mul_mat_with<const RDIMS: usize>( &self, other: &GTensorMetadata<RDIMS>, ) -> bool

Source

pub fn can_repeat_with<const RDIMS: usize>( &self, other: &GTensorMetadata<RDIMS>, ) -> bool
where Dim<RDIMS>: DimValid,

Source

pub fn is_permuted(&self) -> bool

Source

pub fn is_transposed(&self) -> bool

Source

pub fn is_contiguous(&self) -> bool

Source

pub fn is_padded_1d(&self) -> bool

Source

pub fn is_same_shape(&self, other: &Self) -> bool

Trait Implementations§

Source§

impl<const DIMS: usize> Clone for GTensorMetadata<DIMS>

Source§

fn clone(&self) -> GTensorMetadata<DIMS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const DIMS: usize> Debug for GTensorMetadata<DIMS>

Source§

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

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

impl<const DIMS: usize> PartialEq for GTensorMetadata<DIMS>

Source§

fn eq(&self, other: &GTensorMetadata<DIMS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const DIMS: usize> StructuralPartialEq for GTensorMetadata<DIMS>

Auto Trait Implementations§

§

impl<const DIMS: usize> Freeze for GTensorMetadata<DIMS>

§

impl<const DIMS: usize> RefUnwindSafe for GTensorMetadata<DIMS>

§

impl<const DIMS: usize> Send for GTensorMetadata<DIMS>

§

impl<const DIMS: usize> Sync for GTensorMetadata<DIMS>

§

impl<const DIMS: usize> Unpin for GTensorMetadata<DIMS>

§

impl<const DIMS: usize> UnwindSafe for GTensorMetadata<DIMS>

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.