class_docstr: This class tests all functions of the ArithmeticSharedTensor.
docstr: Test gather function of encrypted tensor
docstr_tok: ["Test","gather","function","of","encrypted","tensor"]
code: def test_gather(self) -> None:
      """Test gather function of encrypted tensor"""
      sizes = [(5, 5), (5, 5, 5), (5, 5, 5, 5)]
      for size in sizes:
          for dim in range(len(size)):
              tensor = get_random_test_tensor(size=size, is_float=True)
              index = get_random_test_tensor(size=size, is_float=False)
              index = index.abs().clamp(0, 4)
              encrypted = ArithmeticSharedTensor(tensor)
              reference = tensor.gather(dim, index)
              encrypted_out = encrypted.gather(dim, index)
              self._check(
                  encrypted_out,
                  reference,
                  f"gather failed with size {size}",
              )
  
imports: import itertools
  import logging
  import unittest
  import crypten
  import crypten.communicator
  import torch
  import torch.nn.functional
  from crypten.common.rng import generate_random_ring_element
  from crypten.common.tensor_types import is_float_tensor
  from crypten.common.util import count_wraps
  from crypten.mpc.primitives import ArithmeticSharedTensor
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
label_desc: Use image node_id 37 for calling the TestArithmetic obj's underlying member method code with example usage: obj.test_gather() without return types