#NEWLINE# def test_DownsampleFactorMaxGrad_grad( self ) : #NEWLINE# #INDENT# rng = numpy . random . RandomState ( utt . fetch_seed ( ) ) #NEWLINE# maxpoolshps = ( ( 1 , 1 ) , ( 3 , 2 ) , ( 2 , 3 ) ) #NEWLINE# imval = ( rng . rand ( 2 , 3 , 3 , 4 ) * 10.0 ) #NEWLINE# for maxpoolshp in maxpoolshps : #NEWLINE# #INDENT# for ignore_border in [ True , False ] : #NEWLINE# #INDENT# grad_shape = Pool . out_shape ( imval . shape , maxpoolshp , ignore_border = ignore_border ) #NEWLINE# grad_val = ( rng . rand ( * grad_shape ) * 10.0 ) #NEWLINE# def mp( input , grad ) : #NEWLINE# #INDENT# out = Pool ( maxpoolshp , ignore_border = ignore_border ) ( input ) #NEWLINE# grad_op = MaxPoolGrad ( maxpoolshp , ignore_border = ignore_border ) #NEWLINE# return grad_op ( input , out , grad ) #NEWLINE# #UNINDENT# utt . verify_grad ( mp , [ imval , grad_val ] , rng = rng )