code: def Dropout(x, params, rate=0.0, mode='train', rng=None, **kwargs):
    
    del params, kwargs
    if rng is None:
      msg = ('Dropout layer requires apply_fun to be called with a rng keyword '
             'argument. That is, instead of `Dropout(params, inputs)`, call '
             'it like `Dropout(params, inputs, rng=key)`.')
      raise ValueError(msg)
    if rate >= 1.0:
      raise ValueError('Dropout rate (%f) must be lower than 1.' % rate)
    if mode == 'train' and rate > 0.0:
      keep = backend.random.bernoulli(rng, 1.0 - rate, x.shape)
      return np.where(keep, x / (1.0 - rate), 0)
    else:
      return x
docs: Layer construction function for a dropout layer with given rate.