(mask, name=None)
Constructs a masking matrix to zero out pairwise distances due to missing residues or padding. 

    Args:
        mask: 0/1 vector indicating whether a position should be masked (0) or not (1)

    Returns:
        A square matrix with all 1s except for rows and cols whose corresponding indices in mask are set to 0.
        [MAX_SEQ_LENGTH, MAX_SEQ_LENGTH]
Constructs a masking matrix to zero out pairwise distances due to missing residues or padding.
Constructs a masking matrix to zero out pairwise distances due to missing residues or padding .
def masking_matrix(mask, name=None):
    """ Constructs a masking matrix to zero out pairwise distances due to missing residues or padding. 

    Args:
        mask: 0/1 vector indicating whether a position should be masked (0) or not (1)

    Returns:
        A square matrix with all 1s except for rows and cols whose corresponding indices in mask are set to 0.
        [MAX_SEQ_LENGTH, MAX_SEQ_LENGTH]
    """

    with tf.name_scope(name, 'masking_matrix', [mask]) as scope:
        mask = tf.convert_to_tensor(mask, name='mask')

        mask = tf.expand_dims(mask, 0)
        base = tf.ones([tf.size(mask), tf.size(mask)])
        matrix_mask = base * mask * tf.transpose(mask)

        return matrix_mask
def masking_matrix ( mask , name = None ) : with tf . name_scope ( name , 'masking_matrix' , [ mask ] ) as scope : mask = tf . convert_to_tensor ( mask , name = 'mask' ) mask = tf . expand_dims ( mask , 0 ) base = tf . ones ( [ tf . size ( mask ) , tf . size ( mask ) ] ) matrix_mask = base * mask * tf . transpose ( mask ) return matrix_mask