#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 , extra_kwargs ) : #NEWLINE# #INDENT# from lasagne.layers.dense import NINLayer #NEWLINE# nonlinearity = Mock ( ) #NEWLINE# layer = NINLayer ( dummy_input_layer , num_units = 6 , nonlinearity = nonlinearity , ** extra_kwargs ) #NEWLINE# input = theano . shared ( np . random . uniform ( ( - 1 ) , 1 , ( 2 , 3 , 4 , 5 ) ) ) #NEWLINE# result = layer . get_output_for ( input ) #NEWLINE# assert ( result is nonlinearity . return_value ) #NEWLINE# nonlinearity_arg = dummy_input_layer . call_args [ 0 ] [ 0 ] #NEWLINE# X = input . get_value ( ) #NEWLINE# X = np . rollaxis ( X , 1 ) . T #NEWLINE# X = np . dot ( X , layer . W . get_value ( ) ) #NEWLINE# if ( layer . b is not None ) : #NEWLINE# #INDENT# if layer . untie_biases : #NEWLINE# #INDENT# X += layer . b . get_value ( ) [ : , np . newaxis ] . T #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# X += layer . b . get_value ( ) #NEWLINE# #UNINDENT# #UNINDENT# X = np . rollaxis ( X . T , 0 , 2 ) #NEWLINE# assert np . allclose ( nonlinearity_arg . eval ( ) , X )