def numel
import stelliferous@0.0.2.0/tensor_shape.bend as TensorShapeimport Base
47# Scalar [] has one element. Any zero extent makes an empty shape, even when
48# an earlier partial product would overflow. Nonempty overflow is rejected.
49def numel(shape: Shape) -> Maybe<&2,U32>:
50 Shape{+extents} = shape
51 count_nonempty(has_zero(extents),extents)