'Checks whether lasagne.updates handles float32 inputs correctly'

@pytest.mark.parametrize('method,    kwargs', [['sgd', {'learning_rate': 0.1}], ['momentum', {'learning_rate': 0.1, 'momentum': 0.5}], ['nesterov_momentum', {'learning_rate': 0.1, 'momentum': 0.5}], ['adagrad', {'learning_rate': 0.1, 'epsilon': 1e-06}], ['rmsprop', {'learning_rate': 0.01, 'rho': 0.9, 'epsilon': 1e-06}], ['adadelta', {'learning_rate': 0.01, 'rho': 0.9, 'epsilon': 1e-06}], ['adam', {'learning_rate': 0.01, 'beta1': 0.9, 'beta2': 0.999, 'epsilon': 1e-08}], ['adamax', {'learning_rate': 0.01, 'beta1': 0.9, 'beta2': 0.999, 'epsilon': 1e-08}]])
def test_update_returntype(self, method, kwargs):

    floatX_ = theano.config.floatX
    theano.config.floatX = 'float32'
    try:
        A = theano.shared(lasagne.utils.floatX([1, 1, 1]))
        B = theano.shared(lasagne.utils.floatX([1, 1, 1]))
        update_func = getattr(lasagne.updates, method)
        updates = update_func((self.f(A) + self.f(B)), [A, B], **kwargs)
        assert all(((v.dtype == 'float32') for v in updates))
        for param in kwargs:
            kwargs[param] = np.float32(kwargs[param])
        updates = update_func((self.f(A) + self.f(B)), [A, B], **kwargs)
        assert all(((v.dtype == 'float32') for v in updates))
    finally:
        theano.config.floatX = floatX_
