class_docstr: This class tests all functions of BinarySharedTensor.
class_docstr_tok: ["This","class","tests","all","functions","of","BinarySharedTensor","."]
docstr: Tests tensor encryption and decryption for both positive
  and negative values.
docstr_tok: ["Tests","tensor","encryption","and","decryption","for","both","positive","and","negative","values","."]
code: def test_encrypt_decrypt(self) -> None:
      """
      Tests tensor encryption and decryption for both positive
      and negative values.
      """
      sizes = [
          (),
          (1,),
          (5,),
          (1, 1),
          (1, 5),
          (5, 1),
          (5, 5),
          (1, 5, 5),
          (5, 1, 5),
          (5, 5, 1),
          (5, 5, 5),
          (1, 3, 32, 32),
          (5, 3, 32, 32),
      ]
      for size in sizes:
          # encryption and decryption without source:
          reference = get_random_test_tensor(size=size, is_float=False)
          encrypted_tensor = BinarySharedTensor(reference)
          self._check(
              encrypted_tensor, reference, "en/decryption failed"
          )
          for dst in range(self.world_size):
              self._check(
                  encrypted_tensor,
                  reference,
                  "en/decryption failed",
                  dst=dst,
              )
  
          # encryption and decryption with source:
          for src in range(self.world_size):
              input_tensor = reference if src == self.rank else []
              encrypted_tensor = BinarySharedTensor(
                  input_tensor, src=src, broadcast_size=True
              )
              for dst in range(self.world_size):
                  self._check(
                      encrypted_tensor,
                      reference,
                      "en/decryption with broadcast_size failed",
                      dst=dst,
                  )
  
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 3 for calling the TestBinary obj's underlying member method code with example usage: obj.test_encrypt_decrypt() without return types