code: def embedding_to_padding(emb):
      """Calculates the padding mask based on which embeddings are all zero.
      We have hacked symbol_modality to return all-zero embeddings
      for padding.
  
      Args:
          emb: a Tensor with shape [..., depth].
  
      Returns:
          a float Tensor with shape [...].
      """
      emb_sum = tf.reduce_sum(tf.abs(emb), axis=-1)
      return tf.cast(tf.equal(emb_sum, 0.0), tf.float32)
  
file_path: texar/texar/tf/utils/transformer_utils.py
imports: import tensorflow
  from tensorflow_probability import distributions
label_desc: Use image node_id 1 for calling a global function with example usage: embedding_to_padding(emb) and returns: tf