Adding embedding op (not generic gather, no select).

This commit is contained in:
Nicolas Patry
2023-06-22 22:47:35 +02:00
parent 4ffdeb4e23
commit 5e54f37fe1
8 changed files with 154 additions and 0 deletions

View File

@ -2,6 +2,7 @@ use crate::{CpuStorage, Error, Result};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum DType {
U32,
F32,
F64,
}
@ -9,6 +10,7 @@ pub enum DType {
impl DType {
pub fn size_in_bytes(&self) -> usize {
match self {
Self::U32 => 4,
Self::F32 => 4,
Self::F64 => 8,
}
@ -70,5 +72,6 @@ macro_rules! with_dtype {
}
};
}
with_dtype!(u32, U32);
with_dtype!(f32, F32);
with_dtype!(f64, F64);