#NEWLINE# def test_broadcast_grad( ) : #NEWLINE# #INDENT# rng = numpy . random . RandomState ( utt . fetch_seed ( ) ) #NEWLINE# x1 = T . tensor4 ( 'x' ) #NEWLINE# x1_data = rng . randn ( 1 , 1 , 300 , 300 ) #NEWLINE# sigma = T . scalar ( 'sigma' ) #NEWLINE# sigma_data = 20 #NEWLINE# window_radius = 3 #NEWLINE# filter_1d = T . arange ( ( - window_radius ) , ( x1 + 1 ) ) #NEWLINE# filter_1d = filter_1d . astype ( theano . config . floatX ) #NEWLINE# filter_1d = T . exp ( ( ( ( - 0.5 ) * ( filter_1d ** 2 ) ) / ( sigma ** 2 ) ) ) #NEWLINE# filter_1d = ( filter_1d / filter_1d . sum ( ) ) #NEWLINE# filter_W = filter_1d . dimshuffle ( [ 'x' , 'x' , 0 , 'x' ] ) #NEWLINE# y = theano . tensor . nnet . conv2d ( x1 , filter_W , border_mode = 'full' , filter_shape = [ 1 , 1 , None , None ] ) #NEWLINE# theano . grad ( y . sum ( ) , sigma )