def decided
bendtorch-core@0.1.0.0 · src/autograd/sum_to_size.bend:18
import bendtorch-core@0.1.0.0/src/autograd/sum_to_size.bend as SumToSize
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
18def decided(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +target: Shape.Shape, same: Bool) ->
19 Core.Dynamic & Result<&2, &1, Reduce.Error, Core.Dynamic>:
20 match same:
21 case False{}:
22 Reduce.reduce_to(Core.Packed{shape, tensor}, target)
23 case True{}:
24 cloned(shape, Core.clone(shape, tensor))