def has_ReLU(layer): relus = [lasagne.nonlinearities.rectify, T.nnet.relu] return (hasattr(layer, 'nonlinearity') and layer.nonlinearity in relus)