Skip to content

Commit 005f426

Browse files
authored
add the missing op shape calculators (#188)
1 parent a7cab9f commit 005f426

File tree

1 file changed

+5
-2
lines changed
  • onnxmltools/convert/keras/shape_calculators

1 file changed

+5
-2
lines changed

onnxmltools/convert/keras/shape_calculators/Lazy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# --------------------------------------------------------------------------
66

77
import keras
8+
from distutils.version import StrictVersion
89
from ...common._registration import register_shape_calculator
910

1011

@@ -18,8 +19,10 @@ def calculate_lazy_output_shapes(operator):
1819
register_shape_calculator(keras.layers.advanced_activations.ThresholdedReLU, calculate_lazy_output_shapes)
1920
register_shape_calculator(keras.layers.advanced_activations.ELU, calculate_lazy_output_shapes)
2021
register_shape_calculator(keras.layers.advanced_activations.PReLU, calculate_lazy_output_shapes)
21-
# TODO:Following layer is not supported by the checked-in keras version and requires an upgrade of the checked-in keras
22-
# register_shape_calculator(keras.layers.advanced_activations.Softmax, calculate_lazy_output_shapes)
22+
if StrictVersion(keras.__version__) >= StrictVersion('2.1.3'):
23+
register_shape_calculator(keras.layers.advanced_activations.Softmax, calculate_lazy_output_shapes)
24+
if StrictVersion(keras.__version__) >= StrictVersion('2.2.0'):
25+
register_shape_calculator(keras.layers.advanced_activations.ReLU, calculate_lazy_output_shapes)
2326

2427
# Concate
2528
register_shape_calculator(keras.layers.Concatenate, calculate_lazy_output_shapes)

0 commit comments

Comments
 (0)