diff options
Diffstat (limited to 'candle-core')
-rw-r--r-- | candle-core/src/dtype.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/candle-core/src/dtype.rs b/candle-core/src/dtype.rs index c7a1567f..94ca57d8 100644 --- a/candle-core/src/dtype.rs +++ b/candle-core/src/dtype.rs @@ -67,6 +67,20 @@ impl DType { Self::F64 => 8, } } + + pub fn is_int(&self) -> bool { + match self { + Self::U8 | Self::U32 | Self::I64 => true, + Self::BF16 | Self::F16 | Self::F32 | Self::F64 => false, + } + } + + pub fn is_float(&self) -> bool { + match self { + Self::U8 | Self::U32 | Self::I64 => false, + Self::BF16 | Self::F16 | Self::F32 | Self::F64 => true, + } + } } pub trait WithDType: |