(forecast: t.Tensor, target: t.Tensor, mask: t.Tensor)
return t.mean(t.abs((forecast - target) * weights))
MAPE loss as defined in: https://en.wikipedia.org/wiki/Mean_absolute_percentage_error

    :param forecast: Forecast values. Shape: batch, time
    :param target: Target values. Shape: batch, time
    :param mask: 0/1 mask. Shape: batch, time
    :return: Loss value
MAPE loss as defined in: https://en.wikipedia.org/wiki/Mean_absolute_percentage_error
MAPE loss as defined in : https : // en . wikipedia . org / wiki / Mean_absolute_percentage_error
def mape_loss(forecast: t.Tensor, target: t.Tensor, mask: t.Tensor) -> t.float:
    """
    MAPE loss as defined in: https://en.wikipedia.org/wiki/Mean_absolute_percentage_error

    :param forecast: Forecast values. Shape: batch, time
    :param target: Target values. Shape: batch, time
    :param mask: 0/1 mask. Shape: batch, time
    :return: Loss value
    """
    weights = divide_no_nan(mask, target)
    return t.mean(t.abs((forecast - target) * weights))
def mape_loss ( forecast : t . Tensor , target : t . Tensor , mask : t . Tensor ) -> t . float : weights = divide_no_nan ( mask , target ) return t . mean ( t . abs ( ( forecast - target ) * weights ) )