#NEWLINE# def test_elemmult_grad_6( ) : #NEWLINE# #INDENT# npr . seed ( 9 ) #NEWLINE# for ii in xrange ( NUM_TRIALS ) : #NEWLINE# #INDENT# np_A = npr . randn ( 5 , 1 ) #NEWLINE# np_B = npr . randn ( 1 , 6 ) #NEWLINE# np_C = npr . randn ( 1 , 1 ) #NEWLINE# A = kayak . Parameter ( np_A ) #NEWLINE# B = kayak . Parameter ( np_B ) #NEWLINE# C = kayak . Parameter ( np_C ) #NEWLINE# D = kayak . ElemMult ( A , B , C ) #NEWLINE# E = kayak . MatSum ( D ) #NEWLINE# A . value #NEWLINE# assert ( E . grad ( A ) . shape == np_A . shape ) #NEWLINE# assert ( E . grad ( B ) . shape == np_B . shape ) #NEWLINE# assert ( E . grad ( C ) . shape == np_C . shape ) #NEWLINE# assert ( kayak . util . checkgrad ( A , E ) < MAX_GRAD_DIFF ) #NEWLINE# assert ( kayak . util . checkgrad ( B , E ) < MAX_GRAD_DIFF ) #NEWLINE# assert ( kayak . util . checkgrad ( C , E ) < MAX_GRAD_DIFF )