#NEWLINE# @ pytest . mark . parametrize ( 'extra_kwargs' , [ { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'untie_biases' : True , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'b' : None , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# def test_get_output_for( self , dummy_input_layer , NINLayer_c01b , extra_kwargs ) : #NEWLINE# #INDENT# nonlinearity = Mock ( ) #NEWLINE# layer = NINLayer_c01b ( dummy_input_layer , num_units = 6 , nonlinearity = nonlinearity , ** extra_kwargs ) #NEWLINE# input = theano . shared ( np . random . uniform ( ( - 1 ) , 1 , ( 3 , 4 , 5 , 2 ) ) ) #NEWLINE# result = layer . get_output_for ( layer ) #NEWLINE# assert ( result is nonlinearity . return_value ) #NEWLINE# nonlinearity_arg = nonlinearity . call_args [ 0 ] [ 0 ] #NEWLINE# X = input . get_value ( ) #NEWLINE# W = layer . W . get_value ( ) #NEWLINE# out = np . dot ( W , X . reshape ( X . shape [ 0 ] , ( - 1 ) ) ) #NEWLINE# out = out . reshape ( W . shape [ 0 ] , X . shape [ 1 ] , X . shape [ 2 ] , X . shape [ 3 ] ) #NEWLINE# if ( layer . b is not None ) : #NEWLINE# #INDENT# if layer . untie_biases : #NEWLINE# #INDENT# out += layer . b . get_value ( ) [ ( ... , None ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out += layer . b . get_value ( ) [ : , None , None , None ] #NEWLINE# #UNINDENT# #UNINDENT# assert np . allclose ( nonlinearity_arg . eval ( ) , out )