diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-10-10 10:05:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 09:05:41 +0100 |
commit | 9fea56d28e5f99529da8ed8df1eb508b0f163cc3 (patch) | |
tree | 70562ee56e1c7ef30d289bc18a63c84d5e1e71f4 /candle-core/src | |
parent | bc3351bce4ce0ad24c69f872ffd51dc829fe88c8 (diff) | |
download | candle-9fea56d28e5f99529da8ed8df1eb508b0f163cc3.tar.gz candle-9fea56d28e5f99529da8ed8df1eb508b0f163cc3.tar.bz2 candle-9fea56d28e5f99529da8ed8df1eb508b0f163cc3.zip |
Only optimize float tensors. (#1069)
Diffstat (limited to 'candle-core/src')
-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: |