Skip to content

Commit ae62276

Browse files
committed
add fp8 where bf16 is in tests
1 parent 0475af7 commit ae62276

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

candle-core/tests/custom_op_tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl CustomOp1 for Elu {
2626
"elu",
2727
s,
2828
|s| cpu_backend::unary_map(s, l, |v| fwd(v, self.alpha)),
29-
(BF16, F16, F32, F64)
29+
(F8E4M3, BF16, F16, F32, F64)
3030
);
3131
Ok((storage, l.shape().clone()))
3232
}
@@ -69,7 +69,7 @@ impl CustomOp1 for EluBackward {
6969
"elu-bwd",
7070
s,
7171
|s| cpu_backend::unary_map(s, l, |v| bwd(v, self.alpha)),
72-
(BF16, F16, F32, F64)
72+
(F8E4M3, BF16, F16, F32, F64)
7373
);
7474
Ok((storage, l.shape().clone()))
7575
}
@@ -121,6 +121,7 @@ impl candle_core::InplaceOp1 for Elu {
121121
fn cpu_fwd(&self, s: &mut CpuStorage, _l: &Layout) -> Result<()> {
122122
let alpha = self.alpha;
123123
match s {
124+
CpuStorage::F8E4M3(s) => s.iter_mut().for_each(|v| *v = fwd(*v, alpha)),
124125
CpuStorage::BF16(s) => s.iter_mut().for_each(|v| *v = fwd(*v, alpha)),
125126
CpuStorage::F16(s) => s.iter_mut().for_each(|v| *v = fwd(*v, alpha)),
126127
CpuStorage::F32(s) => s.iter_mut().for_each(|v| *v = fwd(*v, alpha)),

0 commit comments

Comments
 (0)