class_docstr: Applies Dropout to the input.
  
  Dropout consists in randomly setting
  a fraction `rate` of input units to 0 at each update during training time,
  which helps prevent overfitting.
  
  Arguments:
  rate: Float between 0 and 1. Fraction of the input units to drop.
  noise_shape: 1D integer tensor representing the shape of the
    binary dropout mask that will be multiplied with the input.
    For instance, if your inputs have shape
    `(batch_size, timesteps, features)` and
    you want the dropout mask to be the same for all timesteps,
    you can use `noise_shape=(batch_size, 1, features)`.
  seed: A Python integer to use as random seed.
  
  Call arguments:
  inputs: Input tensor (of any rank).
  training: Python boolean indicating whether the layer should behave in
    training mode (adding dropout) or in inference mode (doing nothing).
code: def sparse_dropout(x, rate, noise_shape=None, seed=None):
      random_tensor = tf.random.uniform(
          noise_shape, seed=seed, dtype=x.dtype
      )
      keep_prob = 1 - rate
      scale = 1 / keep_prob
      keep_mask = random_tensor >= rate
      output = tf.sparse.retain(x, keep_mask)
      # output = output * scale  # gradient issues with automatic broadcasting
      output = output * tf.reshape(
          tf.convert_to_tensor(scale, dtype=output.dtype),
          (1,) * output.shape.ndims,
      )
      return output
  
imports: import numpy
  import tensorflow
  from tensorflow.keras import activations
  from tensorflow.keras import backend
  from tensorflow.keras import constraints, initializers, regularizers
  from tensorflow.keras.layers import Layer
  from tensorflow.python.framework import smart_cond
  from spektral.layers import ops
label_desc: Use image node_id 5 for calling the SparseDropout obj's underlying member method code with example usage: obj.sparse_dropout(x, rate, noise_shape, seed) and returns: output