#NEWLINE# def check_forward( self , c_data , x_data , y_data ) : #NEWLINE# #INDENT# c = chainer . Variable ( c_data ) #NEWLINE# x = chainer . Variable ( x_data ) #NEWLINE# y = chainer . Variable ( y_data ) #NEWLINE# z = F . where ( c , x , y ) #NEWLINE# self . assertEqual ( x . data . shape , z . data . shape ) #NEWLINE# for ( c , x , y , z ) in zip ( c . data . flatten ( ) , x . data . flatten ( ) , y . data . flatten ( ) , z . data . flatten ( ) ) : #NEWLINE# #INDENT# if c : #NEWLINE# #INDENT# self . assertEqual ( x , z ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertEqual ( y , z )