def mse_scale

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

import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Loss
import 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))))

Uses (6)

Used by (2)