#NEWLINE# def make_funcs( batch_size , rows , cols , channels , filter_rows , num_filters ) : #NEWLINE# #INDENT# rng = np . random . RandomState ( [ 2012 , 10 , 9 ] ) #NEWLINE# filter_cols = filter_rows #NEWLINE# base_image_value = rng . uniform ( ( - 1.0 ) , 1.0 , ( channels , rows , cols , batch_size ) ) . astype ( 'float32' ) #NEWLINE# base_filters_value = rng . uniform ( ( - 1.0 ) , 1.0 , ( channels , filter_rows , filter_cols , num_filters ) ) . astype ( 'float32' ) #NEWLINE# images = shared ( base_image_value ) #NEWLINE# filters = shared ( base_filters_value , name = 'filters' ) #NEWLINE# output = FilterActs ( ) ( images , filters ) #NEWLINE# output_shared = shared ( output . eval ( ) ) #NEWLINE# cuda_convnet = function ( [ ] , updates = { #NEWLINE# #INDENT# output_shared : output , #NEWLINE# #UNINDENT# } ) #NEWLINE# cuda_convnet . name = 'cuda_convnet' #NEWLINE# images_bc01v = base_image_value . transpose ( 3 , 0 , 1 , 2 ) #NEWLINE# filters_bc01v = base_filters_value . transpose ( 3 , 0 , 1 , 2 ) #NEWLINE# filters_bc01v = filters_bc01v [ : , : , : : ( - 1 ) , : : ( - 1 ) ] #NEWLINE# images_bc01 = shared ( images_bc01v ) #NEWLINE# filters_bc01 = shared ( filters_bc01v ) #NEWLINE# output_conv2d = conv2d ( images_bc01 , filters_bc01 , border_mode = 'valid' , image_shape = images_bc01v . shape , filter_shape = filters_bc01v . shape ) #NEWLINE# output_conv2d_shared = shared ( output_conv2d . eval ( ) ) #NEWLINE# baseline = function ( [ ] , updates = { #NEWLINE# #INDENT# output_conv2d_shared : output_conv2d , #NEWLINE# #UNINDENT# } ) #NEWLINE# baseline . name = 'baseline' #NEWLINE# return ( cuda_convnet , baseline )