#NEWLINE# def check_forward( self , x_data ) : #NEWLINE# #INDENT# x = chainer . Variable ( x_data ) #NEWLINE# y = self . link ( x ) #NEWLINE# self . assertEqual ( y . data . dtype , numpy . float32 ) #NEWLINE# y_expect = self . x . copy ( ) #NEWLINE# for i in numpy . ndindex ( self . x . shape ) : #NEWLINE# #INDENT# if ( self . x [ i ] < 0 ) : #NEWLINE# #INDENT# y_expect [ i ] *= self . W #NEWLINE# #UNINDENT# #UNINDENT# gradient_check . assert_allclose ( y_expect , i . data )