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 scatter/scatter_add function of CUDALongTensor
  
  This test will be skipped for now since torch.scatter provides
  inconsistent result given the same input on CUDA. This is likely
  due to a potential bug on pytorch's implementation of scatter
docstr_tok: ["Test","scatter\/scatter_add","function","of","CUDALongTensor","This","test","will","be","skipped","for","now","since","torch.scatter","provides","inconsistent","result","given","the","same","input","on","CUDA",".","This","is","likely","due","to","a","potential","bug","on","pytorch","'s","implementation","of","scatter"]
code: def test_torch_scatter(self) -> None:
      """Test scatter/scatter_add function of CUDALongTensor
  
      This test will be skipped for now since torch.scatter provides
      inconsistent result given the same input on CUDA. This is likely
      due to a potential bug on pytorch's implementation of scatter
      """
  
      funcs = ["scatter", "scatter_add"]
      sizes = [(5, 5), (5, 5, 5), (5, 5, 5, 5)]
      for func in funcs:
          for size in sizes:
              for dim in range(len(size)):
                  tensor1 = get_random_test_tensor(
                      size=size, is_float=False
                  )
                  tensor2 = get_random_test_tensor(
                      size=size, is_float=False
                  )
                  index = get_random_test_tensor(
                      size=size, is_float=False
                  )
                  index = index.abs().clamp(0, 4)
  
                  t1_cuda = CUDALongTensor(tensor1)
                  t2_cuda = CUDALongTensor(tensor2)
                  idx_cuda = CUDALongTensor(index)
                  reference = getattr(torch, func)(
                      tensor1, dim, index, tensor2
                  )
                  result = getattr(torch, func)(
                      t1_cuda, dim, idx_cuda, t2_cuda
                  )
                  result2 = getattr(t1_cuda, func)(
                      dim, idx_cuda, t2_cuda
                  )
  
                  self.assertTrue(
                      type(result) == CUDALongTensor,
                      "result should be a CUDALongTensor",
                  )
                  self.assertTrue(
                      type(result2) == CUDALongTensor,
                      "result should be a CUDALongTensor",
                  )
                  self._check_int(
                      result.cpu(), reference, "{} failed".format(func)
                  )
                  self._check_int(
                      result2.cpu(), reference, "{} failed".format(func)
                  )
  
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 24 for calling the TestCUDA obj's underlying member method code with example usage: obj.test_torch_scatter() without return types