Skip to content

Commit

Permalink
Fix AttributeError when using tanh with TF 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Nov 5, 2020
1 parent eb56b55 commit b010dc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion konverter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import konverter
from konverter.utils.general import success, info, warning, error, COLORS, color_logo, blue_grad

KONVERTER_VERSION = "v0.2.2" # fixme: unify this
KONVERTER_VERSION = "v0.2.3" # fixme: unify this
KONVERTER_LOGO_COLORED = color_logo(KONVERTER_VERSION)


Expand Down
7 changes: 6 additions & 1 deletion konverter/utils/konverter_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ def get_layer_info(self, layer):

is_linear = False
if layer_class.name not in self.attrs_without_activations:
activation = getattr(layer.activation, '_keras_api_names')
if hasattr(layer.activation, '_keras_api_names'):
activation = getattr(layer.activation, '_keras_api_names')
else: # fixme: TF 2.3 is missing _keras_api_names
activation = 'keras.activations.' + getattr(layer.activation, '__name__')
activation = (activation,) # fixme: expects this as a tuple

if len(activation) == 1:
layer_class.info.activation = self.get_class_from_name(activation[0], 'activations')
if layer_class.info.activation.name not in self.attrs_without_activations:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "keras-konverter"
version = "0.2.2"
version = "0.2.3"
description = "A tool to convert simple Keras models to pure Python + NumPy"
readme = "README.md"
repository = "https://github.com/ShaneSmiskol/Konverter"
Expand Down

0 comments on commit b010dc4

Please sign in to comment.