Trait rai_core::Type

source ·
pub trait Type: Clone + Copy + Debug + PartialEq + 'static {
    type Repr: ElemType<DType = Self>;

    // Required methods
    fn boxed_dtype() -> Box<dyn DType>;
    fn safetensor_dtype(&self) -> Dtype;

    // Provided methods
    fn zero() -> Self::Repr { ... }
    fn one() -> Self::Repr { ... }
    fn from_f64(val: f64) -> Option<Self::Repr> { ... }
    fn primitive_full_zero() -> Full<Self> { ... }
    fn primitive_full_one() -> Full<Self> { ... }
    fn primitive_rand() -> Random<Self> { ... }
    fn primitive_randn() -> Normal<Self> { ... }
    fn primitive_as_type(&self) -> ToDType<Self> { ... }
    fn size_of_elem() -> usize { ... }
}

Required Associated Types§

source

type Repr: ElemType<DType = Self>

Required Methods§

Provided Methods§

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Type for BF16

§

type Repr = bf16

source§

impl Type for F16

§

type Repr = f16

source§

impl Type for F32

§

type Repr = f32

source§

impl Type for F64

§

type Repr = f64

source§

impl Type for I64

§

type Repr = i64

source§

impl Type for U8

§

type Repr = u8

source§

impl Type for U32

§

type Repr = u32