Size in bytes of a single element.
(self)
| 13 | impl DType { |
| 14 | /// Size in bytes of a single element. |
| 15 | pub fn byte_size(self) -> usize { |
| 16 | match self { |
| 17 | DType::F32 => 4, |
| 18 | DType::F64 => 8, |
| 19 | DType::I32 => 4, |
| 20 | DType::I64 => 8, |
| 21 | DType::Bool => 1, |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | /// Human-readable name. |
| 26 | pub fn name(self) -> &'static str { |