def METHOD_NAME(test_case, shape, as_tuple, device):
    np_input = np.random.randn(*shape)
    input = flow.tensor(np_input, dtype=flow.float32, device=flow.device(device))
    of_out = flow.nonzero(input, as_tuple)
    np_out = np_nonzero(np_input, as_tuple)
    if as_tuple:
        test_case.assertTrue(
            np.allclose(tuple(x.numpy() for x in of_out), np_out, 0.0001, 0.0001)
        )
    else:
        test_case.assertTrue(np.allclose(of_out.numpy(), np_out, 0.0001, 0.0001))