def mse_loss
import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Lossimport 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
250# PyTorch's mse_loss(input, target) with mean reduction: d = input - target
251# and e = target - input over the broadcast shape, then the mean of d * d.
252# Both inputs come back unchanged, next to the loss and e and d (in that
253# order, the order the tape saves them), the two differences the backward
254# scales: PyTorch's backward computes
255# (2 / N * d) * g for the input and (2 / N * e) * g for the target.
256def mse_loss(input: Core.Dynamic, target: Core.Dynamic) -> (Core.Dynamic & Core.Dynamic) & Result<&2, &1, Error, Recorded>:
257 mse_first(Elementwise.binary(Elementwise.Sub{}, input, target))