pub fn default_shape_for(shape: &[usize], len: usize) -> Vec<usize>Expand description
Return a canonical 2-D shape for a tensor given its shape slice and element count.
- Empty data (
len == 0) →[0, 1](MATLAB convention for empty arrays). - No shape info (
shape.is_empty()) →[1, 1](scalar). - Otherwise → the tensor’s own shape.