Trait rai_core::DType

source ·
pub trait DType: Debug {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn clone_boxed(&self) -> Box<dyn DType>;
    fn equal(&self, rhs: &dyn DType) -> bool;
    fn primitive_full_zero(&self) -> Box<dyn Primitive>;
    fn primitive_full_one(&self) -> Box<dyn Primitive>;
    fn primitive_rand(&self) -> Box<dyn Primitive>;
    fn primitive_randn(&self) -> Box<dyn Primitive>;
    fn primitive_as_dtype(&self) -> Box<dyn Primitive>;
    fn size_of_elem(&self) -> usize;
    fn safetensor_dtype(&self) -> Dtype;
}

Required Methods§

source

fn as_any(&self) -> &dyn Any

source

fn clone_boxed(&self) -> Box<dyn DType>

source

fn equal(&self, rhs: &dyn DType) -> bool

source

fn primitive_full_zero(&self) -> Box<dyn Primitive>

source

fn primitive_full_one(&self) -> Box<dyn Primitive>

source

fn primitive_rand(&self) -> Box<dyn Primitive>

source

fn primitive_randn(&self) -> Box<dyn Primitive>

source

fn primitive_as_dtype(&self) -> Box<dyn Primitive>

source

fn size_of_elem(&self) -> usize

source

fn safetensor_dtype(&self) -> Dtype

Trait Implementations§

source§

impl<'a> AsDType for &'a dyn DType

source§

fn dtype(&self) -> &dyn DType

source§

fn into_boxed_dtype(self) -> Box<dyn DType>

source§

impl AsDType for Box<dyn DType>

source§

fn dtype(&self) -> &dyn DType

source§

fn into_boxed_dtype(self) -> Box<dyn DType>

source§

impl<'a> From<&'a dyn DType> for Dtype

source§

fn from(value: &'a dyn DType) -> Self

Converts to this type from the input type.
source§

impl From<Dtype> for Box<dyn DType>

source§

fn from(value: Dtype) -> Self

Converts to this type from the input type.
source§

impl<'a> PartialEq for &'a dyn DType

source§

fn eq(&self, rhs: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§

source§

impl<D: Type> DType for D