#NEWLINE# def backward_cpu( self , x , gy ) : #NEWLINE# #INDENT# ( x , ) = x #NEWLINE# ( gy , ) = gy #NEWLINE# try : #NEWLINE# #INDENT# inv_x = numpy . linalg . inv ( x . transpose ( ( 0 , 2 , 1 ) ) ) #NEWLINE# #UNINDENT# except numpy . linalg . LinAlgError : #NEWLINE# #INDENT# raise ValueError ( 'Input has singular matrices.' ) #NEWLINE# #UNINDENT# grad = ( ( inv_x [ : , None , None ] * self . detx [ : , None , None ] ) * inv_x ) #NEWLINE# return ( utils . force_array ( grad ) , )