MMMInputFormat

Trait MMMInputFormat 

Source
pub trait MMMInputFormat:
    Downcast
    + Debug
    + DynHash
    + DynClone
    + Send
    + Sync
    + Display {
    // Required methods
    fn prepare_tensor(
        &self,
        t: &Tensor,
        k_axis: usize,
        mn_axis: usize,
    ) -> Result<Tensor, Error>;
    fn prepare_one(
        &self,
        t: &Tensor,
        k_axis: usize,
        mn_axis: usize,
    ) -> Result<Box<dyn MMMInputValue>, Error>;
    fn precursor(&self) -> WeightType;
    fn r(&self) -> usize;
    fn k_alignment(&self) -> usize;
    fn same_as(&self, other: &(dyn MMMInputFormat + 'static)) -> bool;
    fn mem_size(&self, k: TDim, mn: TDim) -> TDim;
    fn extract_at_mn_f16(
        &self,
        data: &EagerPackedInput,
        mn: usize,
        slice: &mut [f16],
    ) -> Result<(), Error>;
    fn extract_at_mn_f32(
        &self,
        data: &EagerPackedInput,
        mn: usize,
        slice: &mut [f32],
    ) -> Result<(), Error>;

    // Provided method
    fn merge_with<'o, 'a, 'b>(
        &'a self,
        other: &'b (dyn MMMInputFormat + 'static),
    ) -> Option<&'o (dyn MMMInputFormat + 'static)>
       where 'a: 'o,
             'b: 'o { ... }
}

Required Methods§

Source

fn prepare_tensor( &self, t: &Tensor, k_axis: usize, mn_axis: usize, ) -> Result<Tensor, Error>

Source

fn prepare_one( &self, t: &Tensor, k_axis: usize, mn_axis: usize, ) -> Result<Box<dyn MMMInputValue>, Error>

Source

fn precursor(&self) -> WeightType

Source

fn r(&self) -> usize

Source

fn k_alignment(&self) -> usize

Source

fn same_as(&self, other: &(dyn MMMInputFormat + 'static)) -> bool

Source

fn mem_size(&self, k: TDim, mn: TDim) -> TDim

Source

fn extract_at_mn_f16( &self, data: &EagerPackedInput, mn: usize, slice: &mut [f16], ) -> Result<(), Error>

Source

fn extract_at_mn_f32( &self, data: &EagerPackedInput, mn: usize, slice: &mut [f32], ) -> Result<(), Error>

Provided Methods§

Source

fn merge_with<'o, 'a, 'b>( &'a self, other: &'b (dyn MMMInputFormat + 'static), ) -> Option<&'o (dyn MMMInputFormat + 'static)>
where 'a: 'o, 'b: 'o,

Implementations§

Source§

impl dyn MMMInputFormat

Source

pub fn is<__T>(&self) -> bool
where __T: MMMInputFormat,

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T>( self: Box<dyn MMMInputFormat>, ) -> Result<Box<__T>, Box<dyn MMMInputFormat>>
where __T: MMMInputFormat,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T>( self: Rc<dyn MMMInputFormat>, ) -> Result<Rc<__T>, Rc<dyn MMMInputFormat>>
where __T: MMMInputFormat,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T>(&self) -> Option<&__T>
where __T: MMMInputFormat,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>
where __T: MMMInputFormat,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Trait Implementations§

Source§

impl<'clone> Clone for Box<dyn MMMInputFormat + 'clone>

Source§

fn clone(&self) -> Box<dyn MMMInputFormat + 'clone>

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<'clone> Clone for Box<dyn MMMInputFormat + Send + 'clone>

Source§

fn clone(&self) -> Box<dyn MMMInputFormat + Send + 'clone>

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<'clone> Clone for Box<dyn MMMInputFormat + Send + Sync + 'clone>

Source§

fn clone(&self) -> Box<dyn MMMInputFormat + Send + Sync + 'clone>

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<'clone> Clone for Box<dyn MMMInputFormat + Sync + 'clone>

Source§

fn clone(&self) -> Box<dyn MMMInputFormat + Sync + 'clone>

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 From<&(dyn MMMInputFormat + 'static)> for WeightType

Source§

fn from(value: &(dyn MMMInputFormat + 'static)) -> WeightType

Converts to this type from the input type.
Source§

impl<'hash> Hash for dyn MMMInputFormat + 'hash

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn MMMInputFormat + Send + 'hash

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn MMMInputFormat + Send + Sync + 'hash

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn MMMInputFormat + Sync + 'hash

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq for &(dyn MMMInputFormat + 'static)

Source§

fn eq(&self, other: &&(dyn MMMInputFormat + 'static)) -> 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 Eq for &(dyn MMMInputFormat + 'static)

Implementors§