Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,13 @@ A few notes:
| `BatchNormalization` | Available | Available | |

#### Keras Activation functions
| Model | Implementation | Test | Notes |
| ---------------------------- | --------------- | --------- | ----------------------------- |
| `tanh` | Available | Available | |
| `sigmoid` | Available | Available | |
| `relu` | Available | Available | |
| Model | Implementation | Test | Notes |
|-----------| --------------- | --------- |--------------------------------|
| `tanh` | Available | Available | |
| `sigmoid` | Available | Available | |
| `relu` | Available | Available | |
| `elu` | Available | | |
| `celu` | Available | | Only for alpha=1 (celu == elu) |


## Running tests
Expand Down
4 changes: 3 additions & 1 deletion scikinC/layers/BaseLayerConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def activate (self, x):
elif activation == 'tanh':
return "%(x)s = tanh(%(x)s);" % {'x':x}
elif activation == 'relu':
return "%(x)s = %(x)s > 0. ? %(x)s : 0.;" % {'x':x}
return "%(x)s = %(x)s > 0. ? %(x)s : 0.;" % {'x':x}
elif activation == 'celu' or activation == 'elu':
return "%(x)s = %(x)s > 0. ? %(x)s : exp(%(x)s) - 1;" % {'x': x}
elif activation == 'linear':
return ""
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name='scikinC', # Required
version="0.2.8", # Required
version="0.2.9", # Required
description='A converter for scikit learn and keras to hardcoded C function',
long_description=long_description,
long_description_content_type='text/markdown', # Optional (see note above)
Expand Down
2 changes: 2 additions & 0 deletions test/test_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def classifier_dense():
tf.keras.layers.Dense(16, activation='tanh'),
tf.keras.layers.Dense(16, activation='sigmoid'),
tf.keras.layers.Dense(16, activation='relu'),
tf.keras.layers.Dense(16, activation='elu' if hasattr(tf.keras.activations, 'elu') else 'linear'),
tf.keras.layers.Dense(16, activation='celu' if hasattr(tf.keras.activations, 'celu') else 'linear'),
tf.keras.layers.Dense(16),
tf.keras.layers.Dense(1, activation='sigmoid')
])
Expand Down