pub trait IntoShape {
// Required method
fn into_shape(self) -> Result<Vec<usize>, FerrayError>;
}Expand description
Convert a size argument into a concrete shape vector.
Implemented for:
usize— 1-D shape[n](includingn == 0for an empty array)&[usize]— arbitrary-rank shape[usize; N](any N, via const generics)&[usize; N]Vec<usize>
Zero-axis shapes (e.g. 0usize, [3, 0, 4]) are now permitted and
produce an empty array, matching NumPy’s np.random.uniform(size=0)
behaviour (#264, #455). The only rejected shape is a totally
rank-empty &[], which would correspond to a 0-d scalar — that is
not yet wired through the distribution machinery.
Required Methods§
Sourcefn into_shape(self) -> Result<Vec<usize>, FerrayError>
fn into_shape(self) -> Result<Vec<usize>, FerrayError>
Consume self and return the shape as a Vec<usize>.
§Errors
Returns FerrayError::InvalidValue if the resulting shape has
zero rank (i.e. an empty shape slice).