def from_values_counted

bendtorch-core@0.1.0.0 · src/tensor/core.bend:398

import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

398def from_values_counted(+shape: Shape.Shape, +values: List<&2, F32>,
399  decision: Shape.BoolCase<Nat.is_eq(List.length(&2, F32, values), Shape.elements(shape))>) ->
400  Result<&2, &1, Error, Tensor<shape>>:
401  match decision:
402    case Shape.BFalse{equal}:
403      Fail{ValueCountMismatch{}}
404    case Shape.BTrue{equal}:
405      from_values_new(shape, values, new(shape, 0.0))

Uses (12)

Used by (5)