-
Notifications
You must be signed in to change notification settings - Fork 19.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Activation Function: AttributeError: 'Activation' object has no attribute '__name__' #8716
Comments
I got it working by extending the Activation class:
Up to you to accept as an issue and implement it, so nobody would have to extend it, or we can just close the issue. Cheers, |
@wilderrodrigues Hi, I have the same issue with you. Can you show how you implemented the custom activation in class? thank you. |
Hi @brianleegit, Yes, sure. See the code below:
I used this inside a Jupyter Notebook cell. If you are going to do a plain Python implementation, I would suggest to have a 'config' function called from within the constructor. In that function, you set up the 'get_custom_objects'. I hope this helps. Cheers, |
____ interesting ! @wilderrodrigues thank you it is working! |
just to add another example for the swish, this can be called with:
|
Is this compatible while using tensor flow as well ?? |
Since functions in Python have
|
This also happens when you try to save the model with a custom activation. |
In fact, I'm not even implementing my own activation, I am using: |
This also happens when you try to save the model with a custom activation. |
Same issue. How to fix it? I just use it like this:
|
Hi,
I'm working on the development of a custom activation function. It has already been tested with a number of neural networks architectures (e.g. shallow, intermedia, deep (4-layers) CNN (8-layers), ResNet, etc). It's working fine and actually beating ReLU in all the architectures used.
However, when trying to test it on a CNN and using the ModelCheckpoint callback, I got an error during serialisation of the Activation object:
I'm not disclosing my custom activation function yet because it has not been published in any paper, but if you want to reproduce the erro, do the following (this is just a simple ReLU example, not the one I'm working with):
After that, apply the 'ReLU_s' as activation to your CNN layers, create a call back and train the model:
We need a name attribute in the Activation class.
Thanks in advance.
The text was updated successfully, but these errors were encountered: