Skip to content

Commit b010dc4

Browse files
committed
Fix AttributeError when using tanh with TF 2.3
1 parent eb56b55 commit b010dc4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

konverter/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import konverter
44
from konverter.utils.general import success, info, warning, error, COLORS, color_logo, blue_grad
55

6-
KONVERTER_VERSION = "v0.2.2" # fixme: unify this
6+
KONVERTER_VERSION = "v0.2.3" # fixme: unify this
77
KONVERTER_LOGO_COLORED = color_logo(KONVERTER_VERSION)
88

99

konverter/utils/konverter_support.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ def get_layer_info(self, layer):
8787

8888
is_linear = False
8989
if layer_class.name not in self.attrs_without_activations:
90-
activation = getattr(layer.activation, '_keras_api_names')
90+
if hasattr(layer.activation, '_keras_api_names'):
91+
activation = getattr(layer.activation, '_keras_api_names')
92+
else: # fixme: TF 2.3 is missing _keras_api_names
93+
activation = 'keras.activations.' + getattr(layer.activation, '__name__')
94+
activation = (activation,) # fixme: expects this as a tuple
95+
9196
if len(activation) == 1:
9297
layer_class.info.activation = self.get_class_from_name(activation[0], 'activations')
9398
if layer_class.info.activation.name not in self.attrs_without_activations:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "keras-konverter"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
description = "A tool to convert simple Keras models to pure Python + NumPy"
55
readme = "README.md"
66
repository = "https://github.com/ShaneSmiskol/Konverter"

0 commit comments

Comments
 (0)