class_docstr: This class tests all member functions of crypten package
class_docstr_tok: ["This","class","tests","all","member","functions","of","crypten","package"]
code: def test_bernoulli(self):
      for size in [(10,), (10, 10), (10, 10, 10)]:
          probs = torch.rand(size)
          randvec = crypten.bernoulli(probs)
          self.assertTrue(randvec.size() == size, "Incorrect size")
          tensor = randvec.get_plain_text()
          self.assertTrue(
              ((tensor == 0) + (tensor == 1)).all(), "Invalid values"
          )
  
      probs = torch.Tensor(int(1e4)).fill_(0.2)
      randvec = crypten.bernoulli(probs).get_plain_text()
      frac_zero = float((randvec == 0).sum()) / randvec.nelement()
      self.assertTrue(
          math.isclose(frac_zero, 0.8, rel_tol=1e-1, abs_tol=1e-1)
      )
  
imports: import itertools
  import logging
  import math
  import random
  import unittest
  from collections import defaultdict
  import crypten
  import crypten.communicator
  import torch
  import torch.nn.functional
  from crypten.common import serial
  from crypten.common.tensor_types import is_float_tensor
  from crypten.config import cfg
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
  from torch import nn
label_desc: Use image node_id 9 for calling the TestCrypten obj's underlying member method code with example usage: obj.test_bernoulli() without return types