Type Alias ArrayShape

Source
pub type ArrayShape = Vec<u64>;
Expand description

Vector of dimension lengths for each axis of an array.

ArrayShape type could be used for array oriented graph operations such as Sum, PermuteAxes, Get, Stack etc.

ArrayShape is valid if

  • vector is not empty,
  • all the dimension lengths are non-zero,
  • total array capacity (product of dimension lengths) is less than u64::MAX.

ArrayShape is analogous to numpy.ndarray.shape.

§Example

let a_shape0: ArrayShape = vec![10, 1, 20];
let at0 = array_type(a_shape0, UINT32);
assert!(at0.is_valid());
let a_shape1: ArrayShape = vec![];
let at1 = array_type(a_shape1, UINT32);
assert!(!at1.is_valid());
let a_shape2: ArrayShape = vec![10, 0];
let at2 = array_type(a_shape2, UINT32);
assert!(!at2.is_valid());
let a_shape3: ArrayShape = vec![(u64::MAX/2), 3];
let at3 = array_type(a_shape3, UINT32);
assert!(!at3.is_valid());

Aliased Type§

struct ArrayShape { /* private fields */ }