#NEWLINE# def grad( self , inp , grads ) : #NEWLINE# #INDENT# ( x , b ) = inp #NEWLINE# ( g_sm , ) = grads #NEWLINE# if isinstance ( g_sm . type , DisconnectedType ) : #NEWLINE# #INDENT# return [ DisconnectedType ( ) ( ) , DisconnectedType ( ) ( ) ] #NEWLINE# #UNINDENT# sm = softmax_with_bias ( x , b ) #NEWLINE# dx = softmax_grad ( g_sm , sm ) #NEWLINE# db = tensor . sum ( dx , axis = 0 ) #NEWLINE# return ( dx , db )