def METHOD_NAME(
    placement, logits_sbp, labels_sbp, data_type, label_type, batch_size, num_classes,
):
    data_type = type_name_to_flow_type[data_type]
    label_type = type_name_to_flow_type[label_type]
    np_labels = np.random.randint(0, num_classes, size=(batch_size,)).astype(np.int32)
    np_logits = np.random.random((batch_size, num_classes)).astype(np.float32)
    if flow.env.get_rank() == 0:
        torch_logits = torch.tensor(np_logits, dtype=torch.float32, requires_grad=True)
        torch_labels = torch.tensor(np_labels, dtype=torch.int64)
        torch_output = torch.nn.functional.cross_entropy(
            torch_logits, torch_labels, reduction="none"
        )
        torch_output.sum().backward()
    of_logits = flow.tensor(np_logits, dtype=data_type, requires_grad=True).to_global(
        flow.placement.all("cpu"), flow.sbp.broadcast
    )
    of_logits = of_logits.to_global(placement, logits_sbp)
    of_logits.retain_grad()
    of_labels = flow.tensor(np_labels, dtype=label_type).to_global(
        flow.placement.all("cpu"), flow.sbp.broadcast
    )
    of_labels = of_labels.to_global(placement, labels_sbp)
    of_output = flow.nn.functional.sparse_softmax_cross_entropy(
        labels=of_labels, logits=of_logits
    )
    of_output.sum().backward()
    of_logits_grad = of_logits.grad.to_global(
        flow.placement.all("cpu"), flow.sbp.broadcast
    )
    of_logits_grad = of_logits_grad.to_local()
    of_output = of_output.to_global(flow.placement.all("cpu"), flow.sbp.broadcast)
    of_output = of_output.to_local()
    if flow.env.get_rank() == 0:
        assert np.allclose(
            of_output.numpy(), torch_output.detach().numpy(), rtol=1e-03, atol=1e-04
        )
        assert np.allclose(
            of_logits_grad.numpy(), torch_logits.grad, rtol=1e-03, atol=1e-04
        )