<s> import numpy as np <EOL> from theano import function <EOL> import theano . tensor as T <EOL> def make_vector ( ) : <EOL> """<STR_LIT>""" <EOL> return T . vector ( ) <EOL> def make_matrix ( ) : <EOL> """<STR_LIT>""" <EOL> return T . matrix ( ) <EOL> def elemwise_mul ( a , b ) : <EOL> """<STR_LIT>""" <EOL> return a * b <EOL> def matrix_vector_mul ( a , b ) : <EOL> """<STR_LIT>""" <EOL> return T . dot ( a , b ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> a = make_vector ( ) <EOL> b = make_vector ( ) <EOL> c = elemwise_mul ( a , b ) <EOL> d = make_matrix ( ) <EOL> e = matrix_vector_mul ( d , c ) <EOL> f = function ( [ a , b , d ] , e ) <EOL> rng = np . random . RandomState ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> a_value = rng . randn ( <NUM_LIT:5> ) . astype ( a . dtype ) <EOL> b_value = rng . rand ( <NUM_LIT:5> ) . astype ( b . dtype ) <EOL> c_value = a_value * b_value <EOL> d_value = rng . randn ( <NUM_LIT:5> , <NUM_LIT:5> ) . astype ( d . dtype ) <EOL> expected = np . dot ( d_value , c_value ) <EOL> actual = f ( a_value , b_value , d_value ) <EOL> assert np . allclose ( actual , expected ) <EOL> print "<STR_LIT>" </s>
