Explore Courses Blog Tutorials Interview Questions
+1 vote
in Python by (330 points)

I am working on the following code:

model = Sequential()

 a = keras.layers.advanced_activations.PReLU(init='zero', weights=None) model.add(Dense(64, input_dim=14, init='uniform'))



model.add(Dense(64, init='uniform'))



model.add(Dense(2, init='uniform'))


 sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True) model.compile(loss='binary_crossentropy', optimizer=sgd), y_train, nb_epoch=20, batch_size=16, show_accuracy=True, validation_split=0.2, verbose = 2)

Here the problem is I am getting an error “ TypeError: 'PReLU' object is not callable” at the model.compile line. I have checked all the non-advanced activation function is working , only the advanced activation function is not working. Can anyone explain the solution to this?

1 Answer

+2 votes
by (10.9k points)
edited by

@kavita ,The best way to use PReLU is with the add() method and not wrapping it using Activation class.


model = Sequential()

        a = keras.layers.advanced_activations.PReLU(init='zero', weights=None)  

        model.add(Dense(64, input_dim=14, init='uniform'))


Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94k users

Browse Categories