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 convolution of torch.cuda.LongTensor with cuda_patches technique.
code: def _patched_conv1d(
      self, signal_size, in_channels, kernel_sizes=None
  ):
      """Test convolution of torch.cuda.LongTensor with cuda_patches technique."""
      nbatches = [1, 3]
      ochannels = [1, 3, 6]
      paddings = [0, 1]
      strides = [1, 2]
  
      if kernel_sizes is None:
          kernel_sizes = [1, 2, 3]
  
      for func_name in ["conv1d", "conv_transpose1d"]:
          for (
              batches,
              kernel_size,
              out_channels,
              padding,
              stride,
          ) in itertools.product(
              nbatches, kernel_sizes, ochannels, paddings, strides
          ):
              input_size = (batches, in_channels, signal_size)
              signal = get_random_test_tensor(
                  size=input_size, is_float=False
              )
  
              if func_name == "conv1d":
                  k_size = (out_channels, in_channels, kernel_size)
              else:
                  k_size = (in_channels, out_channels, kernel_size)
              kernel = get_random_test_tensor(
                  size=k_size, is_float=False
              )
  
              signal_cuda = CUDALongTensor(signal)
              kernel_cuda = CUDALongTensor(kernel)
  
              reference = getattr(F, func_name)(
                  signal, kernel, padding=padding, stride=stride
              )
              result = getattr(F, func_name)(
                  signal_cuda,
                  kernel_cuda,
                  padding=padding,
                  stride=stride,
              )
              self.assertTrue(
                  type(result) == CUDALongTensor,
                  "result should be a CUDALongTensor",
              )
              result = result.data.cpu()
  
              self._check_int(result, reference, f"{func_name} 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 9 for calling the TestCUDA obj's underlying member method code with example usage: obj._patched_conv1d(signal_size, in_channels, kernel_sizes) without return types