pub fn element_count(shape: &[usize]) -> usizeExpand description
The number of cells in a tensor of the given shape. An empty shape is a
scalar (one cell). This is the one home for the element_count helper that
the generic, broadcast, linalg, and every typed tensor crate re-grew.
ยงExamples
use sim_lib_numbers_tensor::element_count;
assert_eq!(element_count(&[]), 1); // rank-0 scalar
assert_eq!(element_count(&[3]), 3); // length-3 vector
assert_eq!(element_count(&[2, 3]), 6); // 2x3 matrix