code: def dropout_fn(x, drop_prob, shared_axes=None, training=False):
      """
      Apply dropout to input tensor.
      Parameters
      ----------
      x: ``torch.FloatTensor``
          A tensor of shape ``(batch_size, ..., num_timesteps, embedding_dim)``
      Returns
      -------
      output: ``torch.FloatTensor``
          A tensor of shape ``(batch_size, ..., num_timesteps, embedding_dim)``
          with dropout applied.
      """
      if drop_prob == 0 or drop_prob is None or (not training):
          return x
  
      sz = list(x.size())
      for i in shared_axes or []:
          sz[i] = 1
      mask = (
          x.new(*sz).bernoulli_(1.0 - drop_prob).div_(1.0 - drop_prob)
      )
      mask = mask.expand_as(x)
  
      return x * mask
  
imports: import os
  import pickle
  from collections import OrderedDict
  import numpy
  import torch
  import torch.nn
  import yaml
  from scipy import sparse
  from sklearn import preprocessing
  from graph4nlp.pytorch.data.data import GraphData
label_desc: Use image node_id 10 for calling a global function with example usage: dropout_fn(x, drop_prob, shared_axes, training) and returns: unknown, x