code: def layer_prepostprocess_dropout(x, hparams):
      batch_dim = x.shape.dims[0]
      model_dim = x.shape.dims[-1]
      mode = getattr(hparams, "mode", tf_estimator.ModeKeys.TRAIN)
      is_training = mode == tf_estimator.ModeKeys.TRAIN
      return mtf.dropout(
          x,
          is_training,
          keep_prob=1.0 - hparams.layer_prepostprocess_dropout,
          noise_shape=mtf.Shape([batch_dim, model_dim]),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import mesh_tensorflow
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import mtf_model
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 1 for calling a global function with example usage: layer_prepostprocess_dropout(x, hparams) and returns: mtf