def checked
bendtorch-core@0.1.0.0 · src/tensor/slice.bend:187
import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Slice
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
187def checked(+dimensions: List<&2, U32>, +dim: U32, +start: U32, +stop: U32, +step: U32, refused: Maybe<&2, Error>) ->
188 Result<&2, &2, Error, Planned>:
189 match refused:
190 case Some{error}:
191 Fail{error}
192 case None{}:
193 +plan = plan_of(dimensions, dim, start, stop, step)
194 +output = resized(dimensions, U32.to_nat(dim), U32.from_nat(plan_length(plan)))
195 shaped(plan, output, Shape.construct(output))