class_docstr: A layer that stochastically ignores a subset of inputs each training step.
  
  In training, to compensate for the fraction of input values dropped (`rate`),
  all surviving values are multiplied by `1 / (1 - rate)`.
  
  The parameter `shared_axes` allows to specify a list of axes on which
  the mask will be shared: we will use size 1 on those axes for dropout mask
  and broadcast it. Sharing reduces randomness, but can save memory.
  
  This layer is active only during training (`mode='train'`). In other
  circumstances it is a no-op.
  
  Originally introduced in the paper "Dropout: A Simple Way to Prevent Neural
  Networks from Overfitting" available under the following link:
  https://www.cs.toronto.edu/~hinton/absps/JMLRdropout.pdf
class_docstr_tok: ["A","layer","that","stochastically","ignores","a","subset","of","inputs","each","training","step",".","In","training",",","to","compensate","for","the","fraction","of","input","values","dropped","(","`","rate","`",")",",","all","surviving","values","are","multiplied","by","`","1","\/","(","1","-","rate",")","`",".","The","parameter","`","shared_axes","`","allows","to","specify","a","list","of","axes","on","which","the","mask","will","be","shared",":","we","will","use","size","1","on","those","axes","for","dropout","mask","and","broadcast","it",".","Sharing","reduces","randomness",",","but","can","save","memory",".","This","layer","is","active","only","during","training","(","`","mode='train","'","`",")",".","In","other","circumstances","it","is","a","no-op",".","Originally","introduced","in","the","paper","``","Dropout",":","A","Simple","Way","to","Prevent","Neural","Networks","from","Overfitting","''","available","under","the","following","link",":","https",":","\/\/www.cs.toronto.edu\/~hinton\/absps\/JMLRdropout.pdf"]
docstr: Executes this layer as part of a forward pass through the model.
  
  Args:
    x: Tensor of activations.
  
  Returns:
    Tensor of same shape and dtype as the input.
docstr_tok: ["Executes","this","layer","as","part","of","a","forward","pass","through","the","model",".","Args",":","x",":","Tensor","of","activations",".","Returns",":","Tensor","of","same","shape","and","dtype","as","the","input","."]
code: def forward(self, x):
      """Executes this layer as part of a forward pass through the model.
  
      Args:
        x: Tensor of activations.
  
      Returns:
        Tensor of same shape and dtype as the input.
      """
      if self._mode != "train":
          return x
      state, rng = self.state, self.rng
      rate = self._initial_rate
      if isinstance(state, dict) and self._name in state:
          rate = state[self._name]
      if rate == 0.0:
          return x
      mask_shape = list(x.shape)
      for axis in self._shared_axes:
          mask_shape[axis] = 1
      keep_prob = 1.0 - rate
      keep = fastmath.random.bernoulli(
          rng, keep_prob, tuple(mask_shape)
      )
      mask = keep.astype(x.dtype) / keep_prob
      return x * mask
  
imports: from absl import logging
  import numpy
  import tensorflow
  from trax import fastmath
  from trax.fastmath import numpy
  from trax.layers import base
  from trax.layers import initializers
  from trax.layers.assert_shape import assert_shape
  from trax.layers.base import Fn
label_desc: Use image node_id 3 for calling the Dropout obj's underlying member method code with example usage: obj.forward(x) and returns: unknown, x, x