#NEWLINE# def max_norm( self , p , maxnorm ) : #NEWLINE# #INDENT# if ( maxnorm > 0 ) : #NEWLINE# #INDENT# norms = T . sqrt ( T . sum ( T . sqr ( p ) , axis = 0 ) ) #NEWLINE# desired = T . clip ( norms , 0 , maxnorm ) #NEWLINE# p = ( desired * ( desired / ( 1e-07 + norms ) ) ) #NEWLINE# #UNINDENT# return p