def METHOD_NAME(test_case):
    (x, y, weight, ignore_index) = generate_necessity_for_nll_loss()
    m = torch.nn.NLLLoss(
        weight=oneof(weight, nothing()),
        reduction=oneof("none", "sum", "mean"),
        ignore_index=ignore_index,
    )
    m.to(x.device)
    calculate_and_compare_loss(test_case, x, y, m)