def _norm ( self , x ) : return tf . sqrt ( tf . reduce_sum ( tf . square ( x ) , keepdims = True , axis = - 1 ) + 1e-7 )
how to code the norm in python
Compute the safe norm .
def _norm(self, x):
    """Compute the safe norm."""
    return tf.sqrt(tf.reduce_sum(tf.square(x), keepdims=True, axis=-1) + 1e-7)