class_docstr: Operator adding dropout to inputs and outputs of the given cell.
class_docstr_tok: ["Operator","adding","dropout","to","inputs","and","outputs","of","the","given","cell","."]
docstr: Decides whether to perform standard dropout or recurrent dropout.
docstr_tok: ["Decides","whether","to","perform","standard","dropout","or","recurrent","dropout","."]
code: def _dropout(
      self,
      values,
      salt_prefix,
      recurrent_noise,
      keep_prob,
      shallow_filtered_substructure=None,
  ):
      """Decides whether to perform standard dropout or recurrent dropout."""
  
      if shallow_filtered_substructure is None:
          # Put something so we traverse the entire structure; inside the
          # dropout function we check to see if leafs of this are bool or not.
          shallow_filtered_substructure = values
  
      if not self._variational_recurrent:
  
          def dropout(i, do_dropout, v):
              if not isinstance(do_dropout, bool) or do_dropout:
                  return nn_ops.dropout_v2(
                      v,
                      rate=1.0 - keep_prob,
                      seed=self._gen_seed(salt_prefix, i),
                  )
              else:
                  return v
  
          return _enumerated_map_structure_up_to(
              shallow_filtered_substructure,
              dropout,
              *[shallow_filtered_substructure, values],
          )
      else:
  
          def dropout(i, do_dropout, v, n):
              if not isinstance(do_dropout, bool) or do_dropout:
                  return self._variational_recurrent_dropout_value(
                      i, v, n, keep_prob
                  )
              else:
                  return v
  
          return _enumerated_map_structure_up_to(
              shallow_filtered_substructure,
              dropout,
              *[shallow_filtered_substructure, values, recurrent_noise],
          )
  
imports: import hashlib
  import numbers
  import sys
  import types
  import warnings
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.keras.utils import generic_utils
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 9 for calling the DropoutWrapperBase obj's underlying member method code with example usage: obj._dropout(values, salt_prefix, recurrent_noise, keep_prob, shallow_filtered_substructure) and returns: _enumerated_map_structure_up_to, _enumerated_map_structure_up_to, nn_ops, v, self, v