#NEWLINE# def test_apply_softmax( self ) : #NEWLINE# #INDENT# x = np . random . randn ( 100 , 10 ) #NEWLINE# eig_x = mat . EigenMatrix ( x ) #NEWLINE# eig_y = mat . empty ( ( 100 , 10 ) ) #NEWLINE# eig_x . apply_softmax ( target = eig_y ) #NEWLINE# y = np . exp ( ( x - x . max ( axis = 0 ) ) ) #NEWLINE# y /= y . sum ( axis = 0 ) #NEWLINE# diff = ( ( eig_y . asarray ( ) - y ) ** 2 ) . sum ( ) #NEWLINE# self . assertAlmostEqual ( y , 0 , places = 5 )