svod-dtype 0.1.0-alpha.3

Type system for the Svod ML compiler
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

pub trait HasDType {
    const DTYPE: DType;
}

macro_rules! impl_dtype_ext {
    ($($ty:ty => $dtype:expr),* $(,)?) => {
        $(impl HasDType for $ty { const DTYPE: DType = $dtype; })*
    };
}

impl_dtype_ext! {
    bool => DType::Bool,
    i8 => DType::Int8, i16 => DType::Int16, i32 => DType::Int32, i64 => DType::Int64,
    u8 => DType::UInt8, u16 => DType::UInt16, u32 => DType::UInt32, u64 => DType::UInt64,
    f32 => DType::Float32, f64 => DType::Float64,
}