#NEWLINE# def perform( self , node , input_storage , output_storage ) : #NEWLINE# #INDENT# ( x , ) = input_storage #NEWLINE# xdev = ( x - x . max ( axis = 1 ) [ : , None ] ) #NEWLINE# lsm = ( xdev - numpy . log ( numpy . sum ( numpy . exp ( xdev ) , axis = 1 , keepdims = True ) ) ) #NEWLINE# output_storage [ 0 ] [ 0 ] = lsm