class_docstr: This class tests accuracy of distributions provided by random sampling in crypten.
class_docstr_tok: ["This","class","tests","accuracy","of","distributions","provided","by","random","sampling","in","crypten","."]
code: def test_bernoulli(self):
      for p in [0.25 * i for i in range(5)]:
  
          def bernoulli(*size):
              x = crypten.cryptensor(p * torch.ones(*size))
              return x.bernoulli()
  
          self._check_distribution(
              bernoulli, p, p * (1 - p), lb=0, ub=1
          )
  
          # Assert all values are in discrete set {0, 1}
          tensor = bernoulli((1000,)).get_plain_text()
          self.assertTrue(
              ((tensor == 0) + (tensor == 1)).all(),
              "Invalid Bernoulli values",
          )
  
file_path: CrypTen/test/test_distributions.py
imports: import math
  import crypten
  import torch
  from crypten.config import cfg
  from test.multiprocess_test_case import MultiProcessTestCase
label_desc: Use image node_id 4 for calling the TestDistributions obj's underlying member method code with example usage: obj.test_bernoulli() and returns: x