def METHOD_NAME(
    test_case, has_weight=False, split_batch_dim=False, split_class_dim=False
):
    N = random(1, 4) * 2
    C = random(1, 10) * 2
    ndim = random(2, 5).to(int).value()
    dims = [random(2, 10) for i in range(ndim - 2)]
    input_dims = [N, C] + dims
    target_dims = [N] + dims
    input = random_tensor(ndim, *input_dims)
    target = random_tensor(
        ndim - 1, *target_dims, low=0, high=C, dtype=int, requires_grad=False
    )
    weight = None
    if has_weight:
        weight = random_tensor(1, C, requires_grad=False)
    device = random_device().value()
    if not split_class_dim and not split_batch_dim:
        input = input.to(device)
        target = target.to(device)
        if has_weight:
            weight = weight.to(device)
    else:
        rank = flow.env.get_rank()
        world_size = flow.env.get_world_size()
        assert world_size % 2 == 0
        ranks = np.array(range(world_size))
        if split_batch_dim and split_class_dim:
            placement = flow.placement(device, ranks.reshape((ranks.size // 2, 2)))
            input_sbp = [flow.sbp.split(0), flow.sbp.split(1)]
            target_sbp = [flow.sbp.split(0), flow.sbp.broadcast()]
            weight_sbp = [flow.sbp.broadcast(), flow.sbp.split(0)]
        elif split_batch_dim:
            placement = flow.placement(device, ranks)
            input_sbp = flow.sbp.split(0)
            target_sbp = flow.sbp.split(0)
            weight_sbp = flow.sbp.broadcast()
        else:
            placement = flow.placement(device, ranks)
            input_sbp = flow.sbp.split(1)
            target_sbp = flow.sbp.broadcast()
            weight_sbp = flow.sbp.split(0)
        input = input.to_global(placement=placement, sbp=input_sbp)
        target = target.to_global(placement=placement, sbp=target_sbp)
        # print(
        #     f"**[{rank}] input: {input.oneflow.shape} {input.oneflow.placement} {input.oneflow.sbp}"
        # )
        # print(
        #     f"**[{rank}] target: {target.oneflow.shape} {target.oneflow.placement} {target.oneflow.sbp}"
        # )
        if has_weight:
            # print(f"**[{rank}] weight: {weight.oneflow.numpy()}")
            weight = weight.to_global(placement=placement, sbp=weight_sbp)
    # reduction = oneof("none", "sum", "mean")
    reduction = (
        "none"  # Temporarily skip the test of "sum" and "mean" because of unknown error
    )
    if has_weight:
        nll = torch.nn.NLLLoss(weight=weight, reduction=reduction)
    else:
        nll = torch.nn.NLLLoss(reduction=reduction)
    return nll(input, target)