Skip to main content

Module shape

Module shape 

Source
Expand description

Shape rules: one function per concern, all arithmetic checked.

Functions§

check_shape
Validates a declared shape against the limits and returns its element count.
checked_num_elements
Product of the dimensions, or None on overflow. Rank 0 gives 1.
elementwise_shape
The subset of numpy_broadcast that v1 accepts: equal shapes, or one operand that is a scalar. Widening this is a change to this one function.
infer
Infers the output type of op applied to inputs, checking arity first.
numpy_broadcast
The general NumPy broadcasting rule: align trailing dimensions; a dimension of 1 or a missing dimension stretches to the other operand’s.