class_docstr: This class tests all functions of CUDALongTensor as well as its integration with MPCTensor.
class_docstr_tok: ["This","class","tests","all","functions","of","CUDALongTensor","as","well","as","its","integration","with","MPCTensor","."]
docstr: Test torch.nonzero on CUDALongTensor
docstr_tok: ["Test","torch.nonzero","on","CUDALongTensor"]
code: def test_torch_nonzero(self) -> None:
      """Test torch.nonzero on CUDALongTensor"""
      sizes = [(5, 5), (5, 5, 5), (5, 5, 5, 5)]
      for size in sizes:
          t1 = get_random_test_tensor(size=size, is_float=False)
          t1_cuda = CUDALongTensor(t1)
  
          ref = t1.nonzero(as_tuple=False)
          ref_tuple = t1.nonzero(as_tuple=True)
  
          result = t1_cuda.nonzero(as_tuple=False)
          result_tuple = t1_cuda.nonzero(as_tuple=True)
  
          self.assertTrue(
              type(result) == CUDALongTensor,
              "result should be a CUDALongTensor",
          )
          self._check_int(result.cpu(), ref, "nonzero failed")
          for i in range(len(result_tuple)):
              self.assertTrue(
                  type(result_tuple[i]) == CUDALongTensor,
                  "result should be a CUDALongTensor",
              )
              self._check_int(
                  result_tuple[i].cpu(), ref_tuple[i], "nonzero failed"
              )
  
imports: import collections
  import itertools
  import logging
  import unittest
  import crypten
  import torch
  import torch.nn
  import torch.nn.functional
  from crypten.config import cfg
  from crypten.cuda import CUDALongTensor
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
  from test.test_mpc import TestMPC
label_desc: Use image node_id 25 for calling the TestCUDA obj's underlying member method code with example usage: obj.test_torch_nonzero() without return types