def sized
import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Sliceimport Base
111# The view a plan uses. An input with no element gets no cell in either
112# build, so its outer and inner counts are left at 0 rather than formed: the
113# product of the other extents can pass 2^48 - 1, the largest Nat the
114# runtime holds, as [2^24, 2^24, 0] at axis 2 does.
115def sized(+dimensions: List<&2, U32>, +dim: Nat, empty: Bool) -> View:
116 match empty:
117 case True{}:
118 View{0n, axis_extent(dimensions, dim), 0n}
119 case False{}:
120 view(dimensions, dim)