def mse_scale
import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Lossimport Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
45# 2 / N, the factor of PyTorch's mse_loss backward with mean reduction, for
46# the N cells of the broadcast shape.
47def mse_scale(+shape: Shape.Shape) -> F32:
48 F32.div(2.0, count_f32(Shape.logical_numel(Shape.dimensions(shape))))