class_docstr: This class tests all functions of BinarySharedTensor.
class_docstr_tok: ["This","class","tests","all","functions","of","BinarySharedTensor","."]
docstr: Tests bitwise function broadcasting
docstr_tok: ["Tests","bitwise","function","broadcasting"]
code: def test_bitwise_broadcasting(self) -> None:
      """Tests bitwise function broadcasting"""
      bitwise_ops = ["__and__", "__or__", "__xor__"]
      sizes = [
          (),
          (1,),
          (2,),
          (1, 1),
          (1, 2),
          (2, 1),
          (2, 2),
          (1, 1, 1),
          (1, 1, 2),
          (1, 2, 1),
          (2, 1, 1),
          (2, 2, 2),
          (1, 1, 1, 1),
          (1, 1, 1, 2),
          (1, 1, 2, 1),
          (1, 2, 1, 1),
          (2, 1, 1, 1),
          (2, 2, 2, 2),
      ]
  
      for tensor_type in [lambda x: x, BinarySharedTensor]:
          for op in bitwise_ops:
              for size1, size2 in itertools.combinations(sizes, 2):
                  tensor1 = get_random_test_tensor(
                      size=size1, is_float=False
                  )
                  tensor2 = get_random_test_tensor(
                      size=size2, is_float=False
                  )
                  encrypted_tensor1 = BinarySharedTensor(tensor1)
                  tensor2_transformed = tensor_type(tensor2)
  
                  if isinstance(
                      tensor2_transformed, BinarySharedTensor
                  ):
                      tensor2_transformed_type = "private"
                  else:
                      tensor2_transformed_type = "public"
  
                  self._check(
                      getattr(encrypted_tensor1, op)(
                          tensor2_transformed
                      ),
                      getattr(tensor1, op)(tensor2),
                      f"{tensor2_transformed_type} {op} broadcasting "
                      f"failed with sizes {size1}, {size2}",
                  )
  
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 9 for calling the TestBinary obj's underlying member method code with example usage: obj.test_bitwise_broadcasting() without return types