DType

Trait DType 

Source
pub trait DType:
    Debug
    + Clone
    + DTypeOps
    + Send
    + Sync
    + MaybeNeg
    + DeviceReprLike
    + 'static {
    const ZERO: Self;
    const ONE: Self;
    const C_NAME: &'static str;
    const C_DEP: Option<&'static str>;
    const INTEGRAL: bool;

    // Required methods
    fn to_f64(&self) -> f64;
    fn from_f64(x: f64) -> Self;
}
Expand description

Marker trait for tensor datatypes.

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const C_NAME: &'static str

Source

const C_DEP: Option<&'static str>

Source

const INTEGRAL: bool

Required Methods§

Source

fn to_f64(&self) -> f64

Source

fn from_f64(x: f64) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DType for f32

Source§

const ZERO: f32 = 0f32

Source§

const ONE: f32 = 1f32

Source§

const C_NAME: &'static str = "float"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = false

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Source§

impl DType for f64

Source§

const ZERO: f64 = 0f64

Source§

const ONE: f64 = 1f64

Source§

const C_NAME: &'static str = "double"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = false

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Source§

impl DType for i32

Source§

const ZERO: i32 = 0i32

Source§

const ONE: i32 = 1i32

Source§

const C_NAME: &'static str = "int"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = true

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Source§

impl DType for i64

Source§

const ZERO: i64 = 0i64

Source§

const ONE: i64 = 1i64

Source§

const C_NAME: &'static str = "int64_t"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = true

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Source§

impl DType for u8

Source§

const ZERO: u8 = 0u8

Source§

const ONE: u8 = 1u8

Source§

const C_NAME: &'static str = "uint8_t"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = true

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Source§

impl DType for u32

Source§

const ZERO: u32 = 0u32

Source§

const ONE: u32 = 1u32

Source§

const C_NAME: &'static str = "uint32_t"

Source§

const C_DEP: Option<&'static str> = None

Source§

const INTEGRAL: bool = true

Source§

fn to_f64(&self) -> f64

Source§

fn from_f64(x: f64) -> Self

Implementors§