code: def mask_from_embedding(emb):
    
    return weights_nonzero(tf.reduce_sum(tf.abs(emb), axis=3, keepdims=True))
docs: Input embeddings -> padding mask.
  
    We have hacked symbol_modality to return all-zero embeddings for padding.
    Returns a mask with 0.0 in the padding positions and 1.0 elsewhere.
  
    Args:
      emb: a Tensor with shape [batch, width, height, depth].
    Returns:
      a 0.0/1.0 Tensor with shape [batch, width, height, 1].