class_docstr: Helper to remove padding from a tensor before sending to the experts.
  The padding is computed for one reference tensor containing the padding mask
  and then can be applied to any other tensor of shape [dim_origin,...].
  
  Example::
  
          input = [
              [tok1, tok2],
              [tok3, tok4],
              [0, 0],
              [0, 0],
              [tok5, tok6],
              [0, 0],
          ]
          output = [
              [tok1, tok2],
              [tok3, tok4],
              [tok5, tok6],
          ]
docstr: Add padding back to the given tensor.
  
  Args:
      x: A Tensor of shape [dim_compressed,...]
  
  Returns:
      A tensor of shape [dim_origin,...] with
      dim_compressed >= dim_origin. The
      dim is restored from the original reference tensor
code: def restore(self, x):
      """Add padding back to the given tensor.
  
      Args:
          x: A Tensor of shape [dim_compressed,...]
  
      Returns:
          A tensor of shape [dim_origin,...] with
          dim_compressed >= dim_origin. The
          dim is restored from the original reference tensor
      """
      with tf.name_scope("pad_reduce/restore"):
          x = tf.scatter_nd(
              indices=self.nonpad_ids,
              updates=x,
              shape=tf.concat(
                  [self.dim_origin, tf.shape(x)[1:]], axis=0
              ),
          )
      return x
  
file_path: texar/texar/tf/utils/transformer_utils.py
imports: import tensorflow
  from tensorflow_probability import distributions
label_desc: Use image node_id 3 for calling the PadRemover obj's underlying member method code with example usage: obj.restore(x) and returns: x