(insample: t.Tensor, freq: int,
              forecast: t.Tensor, target: t.Tensor, mask: t.Tensor)
return t.mean(t.abs(target - forecast) * masked_masep_inv)
MASE loss as defined in "Scaled Errors" https://robjhyndman.com/papers/mase.pdf

    :param insample: Insample values. Shape: batch, time_i
    :param freq: Frequency value
    :param forecast: Forecast values. Shape: batch, time_o
    :param target: Target values. Shape: batch, time_o
    :param mask: 0/1 mask. Shape: batch, time_o
    :return: Loss value
MASE loss as defined in "Scaled Errors" https://robjhyndman.com/papers/mase.pdf
MASE loss as defined in Scaled Errors https : // robjhyndman . com / papers / mase . pdf
def mase_loss(insample: t.Tensor, freq: int,
              forecast: t.Tensor, target: t.Tensor, mask: t.Tensor) -> t.float:
    """
    MASE loss as defined in "Scaled Errors" https://robjhyndman.com/papers/mase.pdf

    :param insample: Insample values. Shape: batch, time_i
    :param freq: Frequency value
    :param forecast: Forecast values. Shape: batch, time_o
    :param target: Target values. Shape: batch, time_o
    :param mask: 0/1 mask. Shape: batch, time_o
    :return: Loss value
    """
    masep = t.mean(t.abs(insample[:, freq:] - insample[:, :-freq]), dim=1)
    masked_masep_inv = divide_no_nan(mask, masep[:, None])
    return t.mean(t.abs(target - forecast) * masked_masep_inv)
def mase_loss ( insample : t . Tensor , freq : int , forecast : t . Tensor , target : t . Tensor , mask : t . Tensor ) -> t . float : masep = t . mean ( t . abs ( insample [ : , freq : ] - insample [ : , : - freq ] ) , dim = 1 ) masked_masep_inv = divide_no_nan ( mask , masep [ : , None ] ) return t . mean ( t . abs ( target - forecast ) * masked_masep_inv )