Loss.mse_loss: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Loss Lines 250-257 of bendtorch-core@0.1.0.0/src/autograd/loss.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/autograd/loss.bend&start_line=250&end_line=257 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 # PyTorch's mse_loss(input, target) with mean reduction: d = input - target # and e = target - input over the broadcast shape, then the mean of d * d. # Both inputs come back unchanged, next to the loss and e and d (in that # order, the order the tape saves them), the two differences the backward # scales: PyTorch's backward computes # (2 / N * d) * g for the input and (2 / N * e) * g for the target. def mse_loss(input: Core.Dynamic, target: Core.Dynamic) -> (Core.Dynamic & Core.Dynamic) & Result<&2, &1, Error, Recorded>: mse_first(Elementwise.binary(Elementwise.Sub{}, input, target)) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/loss.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/loss.bend&name=Recorded https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/loss.bend&name=mse_first https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Dynamic https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/elementwise.bend&name=Operation https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/elementwise.bend&name=binary