class_docstr: Tests for the Dropout class
class_docstr_tok: ["Tests","for","the","Dropout","class"]
docstr: test_drop: Make sure dropout is activated successfully
docstr_tok: ["test_drop",":","Make","sure","dropout","is","activated","successfully"]
code: def test_drop(self):
      """test_drop: Make sure dropout is activated successfully"""
  
      # We would like to configure the test to deterministically drop,
      # so that the test does not need to use multiple runs.
      # However, tf.nn.dropout divides by include_prob, so zero or
      # infinitesimal include_prob causes NaNs.
      # 1e-8 does not cause NaNs and shouldn't be a significant source
      # of test flakiness relative to dependency downloads failing, etc.
      model = MLP(
          input_shape=[1, 1],
          layers=[Dropout(name="output", include_prob=1e-8)],
      )
      x = tf.constant([[1]], dtype=tf.float32)
      y = model.get_layer(x, "output", dropout=True)
      sess = tf.Session()
      y_value = sess.run(y)
      # Subject to very rare random failure because include_prob is not exact 0
      self.assertClose(y_value, 0.0)
  
file_path: cleverhans/cleverhans_v3.1.0/tests_tf/test_picklable_model.py
imports: import numpy
  import tensorflow
  from cleverhans.devtools.checks import CleverHansTest
  from cleverhans.picklable_model import Dropout
  from cleverhans.picklable_model import MLP
  from cleverhans.picklable_model import PerImageStandardize
label_desc: Use image node_id 2 for calling the TestDropout obj's underlying member method code with example usage: obj.test_drop() without return types