code: def dropout(
      x: Union[ivy.Array, ivy.NativeArray],
      prob: float,
      /,
      *,
      scale: bool = True,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      training: bool = True,
      seed: Optional[int] = None,
      noise_shape: Optional[Sequence[int]] = None,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Randomly setting a fraction of input tensor to zeroes with probability.
  
      `prob` at each update during training time to prevent possible overfitting.
      The inputs not set to 0 are scaled up `1 / (1 - prob)` by default, so that
      overall sum is unchanged at training time and inference time.
  
      Parameters
      ----------
      x
          The input array x to perform dropout on.
      prob
          The probability of zeroing out each array element, float between 0 and 1.
      scale
          Whether to scale the output by `1/(1-prob)`. Default is ``True``.
      dtype
          output array data type. If dtype is None, the output array data type
          must be inferred from x. Default is ``None``.
      training
          Turn on dropout if training, turn off otherwise. Default is ``True``.
      seed
          Set a default seed for random number generating (for reproducibility). Default
          is ``None``.
      noise_shape
          a sequence representing the shape of the binary dropout mask that will be
          multiplied with the input. A shape dimension set to None means that a different
          mask value will be applied to each element of the input across that dimension. A
          dimension set to 1 means the same mask value will be applied to all elements of
          the input across that dimension.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          Result array after dropout is performed.
  
      Both the description and the type hints above assumes an array input for simplicity,
      but this function is *nestable*, and therefore also accepts :class:`ivy.Container`
      instances in place of any of the arguments.
  
      Examples
      --------
      With :class:`ivy.Array` input:
  
      >>> x = ivy.array([[1., 2., 3.],
      ...                [4., 5., 6.],
      ...                [7., 8., 9.],
      ...                [10., 11., 12.]])
      >>> y = ivy.dropout(x,0.3)
      >>> print(y)
      ivy.array([[ 1.42857146,  2.85714293,  4.28571415],
             [ 0.        ,  7.14285755,  8.5714283 ],
             [10.        , 11.4285717 ,  0.        ],
             [14.2857151 ,  0.        , 17.1428566 ]])
  
  
      >>> x = ivy.array([[1.5, 2.6],
      ...                [4.9, 6.6],
      ...                [7.2, 8.7]])
      >>> y = ivy.dropout(x,0.5)
      >>> print(y)
      ivy.array([[ 0.        ,  5.19999981],
                 [ 0.        ,  0.        ],
                 [ 0.        , 17.39999962]])
  
      >>> x = ivy.array([[1., 2., 3.],
      ...                [4., 5., 6.],
      ...                [7., 8., 9.],
      ...                [10., 11., 12.]])
      >>> y = ivy.dropout(x,0.3,scale=False)
      >>> print(y)
      ivy.array([[ 1.,  2., 3.],
                 [ 4.,  5., 0.],
                 [ 7.,  0., 9.],
                 [10., 11., 0.]])
  
      >>> x = ivy.array([[1.5, 2.6],
      ...                [4.9, 6.6],
      ...                [7.2, 8.7]])
      >>> y = ivy.dropout(x,0.5,scale=False)
      >>> print(y)
      ivy.array([[0., 2.6],
                 [0., 0. ],
                 [0., 8.7]])
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a=ivy.array([[1., 2., 3.], [4., 5., 6.]]),
      ...                   b=ivy.array([7., 8., 9.]))
      >>> y = ivy.dropout(x,0.3)
      >>> print(y)
      {
      a: ivy.array([[0., 0., 4.28571415],
                    [5.71428585, 7.14285755, 0.]]),
      b: ivy.array([0., 11.4285717, 12.8571434])
      }
  
      >>> x = ivy.Container(a=ivy.array([[1.1, 2.2, 3.3], [11., 22., 33.]]),
      ...                   b=ivy.array([[1.245, 0.278, 4.105], [7., 13., 17.]]))
      >>> y = ivy.dropout(x,0.5)
      >>> print(y)
      {
          a: ivy.array([[0., 4.4000001, 6.5999999],
                        [22., 44., 0.]]),
          b: ivy.array([[2.49000001, 0.55599999, 8.21000004],
                        [14., 0., 0.]])
      }
  
      >>> x = ivy.Container(a=ivy.array([[1., 2., 3.], [4., 5., 6.]]),
      ...                   b=ivy.array([7., 8., 9.]))
      >>> y = ivy.dropout(x,0.3)
      >>> print(y)
      {
          a: ivy.array([[0., 0., 3.],
                        [4., 5., 0.]]),
          b: ivy.array([0., 8., 9.])
      }
  
      >>> x = ivy.Container(a=ivy.array([[1.1, 2.2, 3.3], [11., 22., 33.]]),
      ...                   b=ivy.array([[1.245, 0.278, 4.105], [7., 13., 17.]]))
      >>> y = ivy.dropout(x,0.5)
      >>> print(y)
      {
          a: ivy.array([[0., 2.2, 3.3],
                        [11., 22., 0.]]),
          b: ivy.array([[1.245, 0.278, 4.105],
                        [7., 0., 0.]])
      }
      """
      if prob == 0 or not training:
          if dtype is not None and x.dtype != dtype:
              x = ivy.astype(x, dtype)
          return ivy.inplace_update(out, x) if ivy.exists(out) else x
      if noise_shape is None:
          noise_shape = x.shape
      else:
          noise_shape = list(noise_shape)
          for i, v in enumerate(noise_shape):
              if v is None:
                  noise_shape[i] = x.shape[i]
      mask = ivy.where(
          ivy.random_uniform(
              shape=noise_shape,
              device=ivy.dev(x),
              dtype=dtype,
              seed=seed,
          )
          < prob,
          0.0,
          1.0,
      )
      x = x * mask
      if scale:
          x = ivy.multiply(x, 1.0 / (1.0 - prob), out=out)
      return ivy.inplace_update(out, x) if ivy.exists(out) else x
  
imports: from typing import Optional, Tuple, Union, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 4 for calling a global function with example usage: dropout() and returns: unknown, unknown