Binary op for u32.

This commit is contained in:
laurent
2023-06-23 14:50:52 +01:00
parent 92da45879c
commit 08394f7924
2 changed files with 22 additions and 0 deletions

View File

@ -113,6 +113,15 @@ impl CpuStorage {
.collect();
Ok(Self::F64(data))
}
(Self::U32(lhs), Self::U32(rhs)) => {
let lhs_index = StridedIndex::new(shape.dims(), lhs_stride);
let rhs_index = StridedIndex::new(shape.dims(), rhs_stride);
let data = lhs_index
.zip(rhs_index)
.map(|(lhs_i, rhs_i)| B::u32(lhs[lhs_i], rhs[rhs_i]))
.collect();
Ok(Self::U32(data))
}
_ => {
// This should be covered by the dtype check above.
Err(Error::DTypeMismatchBinaryOp {