def divided_by

bendtorch-core@0.1.0.0 · src/autograd/loss.bend:175

import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Loss
import Base
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction

175def divided_by(+count: Nat, pair: Core.Dynamic & Core.Dynamic,
176  divisor: Result<&2, &1, Core.Error, Core.Tensor<Reduction.scalar_shape()>>) -> Result<&2, &1, Core.Error, Core.Dynamic>:
177  (input, total) = pair
178  match divisor:
179    case Fail{error}:
180      Fail{error}
181    case Done{tensor}:
182      quotient(Elementwise.binary(Elementwise.Divide{}, total, Core.pack(Reduction.scalar_shape(), tensor)))

Uses (12)

Used by (1)