class_docstr: This class tests all functions of BinarySharedTensor.
class_docstr_tok: ["This","class","tests","all","functions","of","BinarySharedTensor","."]
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=False)
              index = get_random_test_tensor(size=size, is_float=False)
              index = index.abs().clamp(0, 4)
              encrypted = BinarySharedTensor(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 torch
  from crypten.common.tensor_types import is_int_tensor
  from crypten.mpc.primitives import BinarySharedTensor
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
label_desc: Use image node_id 21 for calling the TestBinary obj's underlying member method code with example usage: obj.test_gather() without return types