Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Adding Keras-Contrib functions using string alias #564

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import numpy as np

# I wish Keras had the Parametric Exponential Linear activation..
# Oh, wait..!
from keras_contrib.layers.advanced_activations import PELU
from keras_contrib.layers.advanced_activations.pelu import PELU

# Create the Keras model, including the PELU advanced activation
model = Sequential()
Expand All @@ -83,6 +83,23 @@ model.fit(x=np.random.random((100, 10)), y=np.random.random((100, 100)), epochs=
model.save('example.h5')
```

### Adding keras-contrib library functions using string alias

```python
from tensorflow import keras
from tensorflow.keras import layers
from keras_contrib.layers.advanced_activations.sinerelu import SineReLU
from tensorflow.keras.layers import Conv2D
from keras.utils.generic_utils import get_custom_objects
from keras.layers import Activation

#calling custom activation functions and adding them to arguments list
get_custom_objects().update({'SineReLU': Activation(SineReLU)})

model.add(Conv2D(256, (3,3), activation='SineReLU'))

```


### A Common "Gotcha"

Expand Down