def METHOD_NAME(testcase):
    arg_dict = OrderedDict()
    arg_dict["device_type"] = ["cuda", "cpu"]
    arg_dict["dim"] = [2, 3, 4, 5]
    arg_dict["reduction"] = ["sum", "mean"]
    arg_dict["cls"] = [flow.nn.CrossEntropyLoss, flow.nn.NLLLoss]
    arg_dict["data_generator"] = [generate_necessity_for_cross_entropy_or_nll_loss]
    for arg in GenArgList(arg_dict):
        compare_loss(*arg)