def METHOD_NAME(
    test_case,
    batchsize,
    in_feature,
    hidden_size_list,
    out_feature,
    skip_final_activation,
    dtype,
    device,
):
    x = np.random.uniform(low=-1, high=1, size=(batchsize, in_feature))
    fused_x = flow.tensor(x, dtype=dtype, device=device, requires_grad=True)
    naive_x = flow.tensor(x, dtype=dtype, device=device, requires_grad=True)
    fused_weight_list = []
    naive_weight_list = []
    fused_bias_list = []
    naive_bias_list = []
    hidden_num = len(hidden_size_list)
    if hidden_num != 0:
        np_first_weight = np.random.uniform(
            low=-1, high=1, size=(hidden_size_list[0], in_feature)
        )
        np_first_bias = np.random.uniform(low=-1, high=1, size=hidden_size_list[0])
        fused_weight_list.append(
            flow.tensor(np_first_weight, dtype=dtype, device=device, requires_grad=True)
        )
        fused_bias_list.append(
            flow.tensor(np_first_bias, dtype=dtype, device=device, requires_grad=True)
        )
        naive_weight_list.append(
            flow.tensor(np_first_weight, dtype=dtype, device=device, requires_grad=True)
        )
        naive_bias_list.append(
            flow.tensor(np_first_bias, dtype=dtype, device=device, requires_grad=True)
        )
    for idx in range(1, hidden_num):
        np_weight = np.random.uniform(
            low=-1, high=1, size=(hidden_size_list[idx], hidden_size_list[idx - 1])
        )
        np_bias = np.random.uniform(low=-1, high=1, size=hidden_size_list[idx])
        fused_weight_list.append(
            flow.tensor(np_weight, dtype=dtype, device=device, requires_grad=True)
        )
        fused_bias_list.append(
            flow.tensor(np_bias, dtype=dtype, device=device, requires_grad=True)
        )
        naive_weight_list.append(
            flow.tensor(np_weight, dtype=dtype, device=device, requires_grad=True)
        )
        naive_bias_list.append(
            flow.tensor(np_bias, dtype=dtype, device=device, requires_grad=True)
        )
    np_final_weight = np.random.uniform(low=-1, high=1, size=(out_feature, in_feature))
    if hidden_num != 0:
        np_final_weight = np.random.uniform(
            low=-1, high=1, size=(out_feature, hidden_size_list[-1])
        )
    np_final_bias = np.random.uniform(low=-1, high=1, size=(out_feature))
    fused_weight_list.append(
        flow.tensor(np_final_weight, dtype=dtype, device=device, requires_grad=True)
    )
    fused_bias_list.append(
        flow.tensor(np_final_bias, dtype=dtype, device=device, requires_grad=True)
    )
    naive_weight_list.append(
        flow.tensor(np_final_weight, dtype=dtype, device=device, requires_grad=True)
    )
    naive_bias_list.append(
        flow.tensor(np_final_bias, dtype=dtype, device=device, requires_grad=True)
    )
    fused_out = flow._C.fused_matmul_bias_add_relu_dropout(
        fused_x,
        fused_weight_list,
        fused_bias_list,
        # We do not add dropout in unittest, cause its result is random.
        dropout_rate_list=[0.0] * len(fused_weight_list),
        skip_final_activation=skip_final_activation,
    )
    naive_out = _matmul_bias_relu(
        naive_x,
        naive_weight_list[0],
        naive_bias_list[0],
        False if hidden_num != 0 else skip_final_activation,
    )
    for idx in range(1, hidden_num + 1):
        if idx == hidden_num:
            naive_out = _matmul_bias_relu(
                naive_out,
                naive_weight_list[idx],
                naive_bias_list[idx],
                skip_final_activation,
            )
        else:
            naive_out = _matmul_bias_relu(
                naive_out, naive_weight_list[idx], naive_bias_list[idx], False
            )
    total_out = fused_out.sum() + naive_out.sum()
    total_out.backward()
    test_case.assertTrue(
        np.allclose(fused_out.numpy(), naive_out.numpy(), atol=1e-4, rtol=1e-4)
    )
    # Test weight grad equality
    for idx in range(hidden_num + 1):
        test_case.assertTrue(
            np.allclose(
                fused_weight_list[idx].grad.numpy(),
                naive_weight_list[idx].grad.numpy(),
                atol=1e-4,
                rtol=1e-4,
            )
        )
        test_case.assertTrue(
            np.allclose(
                fused_bias_list[idx].grad.numpy(),
                naive_bias_list[idx].grad.numpy(),
                atol=1e-4,
                rtol=1e-4,
            )
        )
    # Test dx equality
    test_case.assertTrue(
        np.allclose(fused_x.grad.numpy(), naive_x.grad.numpy(), atol=1e-4, rtol=1e-4)
    )