def METHOD_NAME(inputs, target: torch.Tensor, weight: list):
    losses = {}
    if isinstance(inputs, dict):
        # Training - received a dict with auxiliary classifier outputs which
        # are downsampled relative to the ground-truth labels and input image
        target_ds4 = downsample_labels(target, downsample_factor=4)
        target_ds8 = downsample_labels(target, downsample_factor=8)
        target_ds16 = downsample_labels(target, downsample_factor=16)
        losses["ds4"] = F.cross_entropy(inputs["ds4"], target_ds4, ignore_index=255, weight=weight)
        losses["ds8"] = F.cross_entropy(inputs["ds8"], target_ds8, ignore_index=255, weight=weight)
        losses["ds16"] = F.cross_entropy(inputs["ds16"], target_ds16, ignore_index=255, weight=weight)
        return losses["ds4"] + 0.4 * losses["ds8"] + 0.4 * losses["ds16"]
    # Testing - received classifier outputs with the same resolution as
    # the input image
    return F.cross_entropy(inputs, target, ignore_index=255, weight=weight)