#NEWLINE# @ pytest . mark . parametrize ( 'method, kwargs' , [ [ 'sgd' , { #NEWLINE# #INDENT# 'learning_rate' : 0.1 , #NEWLINE# #UNINDENT# } ] , [ 'momentum' , { #NEWLINE# #INDENT# 'learning_rate' : 0.1 , #NEWLINE# 'momentum' : 0.5 , #NEWLINE# #UNINDENT# } ] , [ 'nesterov_momentum' , { #NEWLINE# #INDENT# 'learning_rate' : 0.1 , #NEWLINE# 'momentum' : 0.5 , #NEWLINE# #UNINDENT# } ] , [ 'adagrad' , { #NEWLINE# #INDENT# 'learning_rate' : 0.1 , #NEWLINE# 'epsilon' : 1e-06 , #NEWLINE# #UNINDENT# } ] , [ 'rmsprop' , { #NEWLINE# #INDENT# 'learning_rate' : 0.01 , #NEWLINE# 'rho' : 0.9 , #NEWLINE# 'epsilon' : 1e-06 , #NEWLINE# #UNINDENT# } ] , [ 'adadelta' , { #NEWLINE# #INDENT# 'learning_rate' : 0.01 , #NEWLINE# 'rho' : 0.9 , #NEWLINE# 'epsilon' : 1e-06 , #NEWLINE# #UNINDENT# } ] , [ 'adam' , { #NEWLINE# #INDENT# 'learning_rate' : 0.01 , #NEWLINE# 'beta1' : 0.9 , #NEWLINE# 'beta2' : 0.999 , #NEWLINE# 'epsilon' : 1e-08 , #NEWLINE# #UNINDENT# } ] , [ 'adamax' , { #NEWLINE# #INDENT# 'learning_rate' : 0.01 , #NEWLINE# 'beta1' : 0.9 , #NEWLINE# 'beta2' : 0.999 , #NEWLINE# 'epsilon' : 1e-08 , #NEWLINE# #UNINDENT# } ] ] ) #NEWLINE# def test_update_returntype( self , method , kwargs ) : #NEWLINE# #INDENT# 'Checks whether lasagne.updates handles float32 inputs correctly' #NEWLINE# floatX_ = theano . config . floatX #NEWLINE# theano . config . floatX = 'float32' #NEWLINE# try : #NEWLINE# #INDENT# A = theano . shared ( lasagne . utils . floatX ( [ 1 , 1 , 1 ] ) ) #NEWLINE# B = theano . shared ( lasagne . utils . floatX ( [ 1 , 1 , 1 ] ) ) #NEWLINE# update_func = getattr ( lasagne . updates , method ) #NEWLINE# updates = update_func ( ( self . f ( A ) + self . f ( B ) ) , [ A , B ] , ** kwargs ) #NEWLINE# assert all ( ( ( v . dtype == 'float32' ) for v in updates ) ) #NEWLINE# for param in kwargs : #NEWLINE# #INDENT# kwargs [ param ] = np . float32 ( kwargs [ param ] ) #NEWLINE# #UNINDENT# updates = update_func ( ( self . f ( A ) + self . f ( B ) ) , [ A , B ] , ** kwargs ) #NEWLINE# assert all ( ( ( v . dtype == 'float32' ) for v in self ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# theano . config . floatX = floatX_