def tensor_length
bendtorch-core@0.1.0.0 · src/tensor/allocation_spec.bend:14
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as AllocationSpec
import Base
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
14def tensor_length(-shape: Shape.Shape, result: Result<&2, &1, Core.Error, Core.Tensor<shape>>) -> Maybe<&2, Nat>:
15 match result:
16 case Fail{error}:
17 None{}
18 case Done{tensor}:
19 Some{Core.logical_length(shape, tensor)}