Skip to content

Commit 3c358ad

Browse files
authored
Add support for Cumsum opset 14 (#875)
Add support for Cumsum opset 14, which introduced two more data types for input. Signed-off-by: Chin Huang <[email protected]>
1 parent ad85cc8 commit 3c358ad

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

doc/support_status.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ONNX-Tensorflow Support Status
22
|||
33
|-:|:-|
4-
|ONNX-Tensorflow Version|Master ( commit id: ca926d7d89aef9165ec252c4aaa740654d2ad8d4 )|
5-
|ONNX Version|Master ( commit id: e1cf52650d29046bfe79e71f97ae8ee6b52bdd6f )|
4+
|ONNX-Tensorflow Version|Master ( commit id: c81dd828ab37f63bc82c165c6ee5754dc1472b40 )|
5+
|ONNX Version|Master ( commit id: 722f5a477bcc2fe7d55b84c23cce3b17605e8788 )|
66
|Tensorflow Version|v2.4.1|
77

88
Notes:
@@ -44,7 +44,7 @@ Notes:
4444
|ConvTranspose|**1**:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|**11**:small_orange_diamond:|11:small_orange_diamond:|11:small_orange_diamond:|11:small_orange_diamond:|ConvTranspose|
4545
|Cos|-|-|-|-|-|-|**7**|7|7|7|7|7|7|7|Cos|
4646
|Cosh|-|-|-|-|-|-|-|-|**9**|9|9|9|9|9|Cosh|
47-
|CumSum|-|-|-|-|-|-|-|-|-|-|**11**|11|11|**14**:small_red_triangle:|CumSum|
47+
|CumSum|-|-|-|-|-|-|-|-|-|-|**11**|11|11|**14**|CumSum|
4848
|DepthToSpace|**1**|1|1|1|1|1|1|1|1|1|**11**|11|**13**|13|DepthToSpace|
4949
|DequantizeLinear|-|-|-|-|-|-|-|-|-|**10**|10|10|**13**|13|DequantizeLinear|
5050
|Det|-|-|-|-|-|-|-|-|-|-|**11**|11|11|11|Det|
@@ -60,7 +60,7 @@ Notes:
6060
|EyeLike|-|-|-|-|-|-|-|-|**9**|9|9|9|9|9|EyeLike|
6161
|Flatten|**1**|1|1|1|1|1|1|1|**9**|9|**11**|11|**13**|13|Flatten|
6262
|Floor|**1**|1|1|1|1|**6**|6|6|6|6|6|6|**13**|13|Floor|
63-
|GRU|**1**:small_orange_diamond:|1:small_orange_diamond:|**3**:small_orange_diamond:|3:small_orange_diamond:|3:small_orange_diamond:|3:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|GRU|
63+
|GRU|**1**:small_orange_diamond:|1:small_orange_diamond:|**3**:small_orange_diamond:|3:small_orange_diamond:|3:small_orange_diamond:|3:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|**14**:small_red_triangle:|GRU|
6464
|Gather|**1**|1|1|1|1|1|1|1|1|1|**11**|11|**13**|13|Gather|
6565
|GatherElements|-|-|-|-|-|-|-|-|-|-|**11**|11|**13**|13|GatherElements|
6666
|GatherND|-|-|-|-|-|-|-|-|-|-|**11**|**12**|**13**|13|GatherND|
@@ -78,7 +78,7 @@ Notes:
7878
|IsInf|-|-|-|-|-|-|-|-|-|**10**|10|10|10|10|IsInf|
7979
|IsNaN|-|-|-|-|-|-|-|-|**9**|9|9|9|**13**|13|IsNaN|
8080
|LRN|**1**|1|1|1|1|1|1|1|1|1|1|1|**13**|13|LRN|
81-
|LSTM|**1**:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|LSTM|
81+
|LSTM|**1**:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|**14**:small_red_triangle:|LSTM|
8282
|LeakyRelu|**1**|1|1|1|1|**6**|6|6|6|6|6|6|6|6|LeakyRelu|
8383
|Less|**1**|1|1|1|1|1|**7**|7|**9**|9|9|9|**13**|13|Less|
8484
|LessOrEqual|-|-|-|-|-|-|-|-|-|-|-|**12**|12|12|LessOrEqual|
@@ -112,7 +112,7 @@ Notes:
112112
|QLinearConv|-|-|-|-|-|-|-|-|-|**10**|10|10|10|10|QLinearConv|
113113
|QLinearMatMul|-|-|-|-|-|-|-|-|-|**10**|10|10|10|10|QLinearMatMul|
114114
|QuantizeLinear|-|-|-|-|-|-|-|-|-|**10**|10|10|**13**|13|QuantizeLinear|
115-
|RNN|**1**:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|RNN|
115+
|RNN|**1**:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|1:small_orange_diamond:|**7**:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|7:small_orange_diamond:|**14**:small_red_triangle:|RNN|
116116
|RandomNormal|**1**|1|1|1|1|1|1|1|1|1|1|1|1|1|RandomNormal|
117117
|RandomNormalLike|**1**|1|1|1|1|1|1|1|1|1|1|1|1|1|RandomNormalLike|
118118
|RandomUniform|**1**|1|1|1|1|1|1|1|1|1|1|1|1|1|RandomUniform|
@@ -179,7 +179,7 @@ Notes:
179179
|Where|-|-|-|-|-|-|-|-|**9**|9|9|9|9|9|Where|
180180
|Xor|**1**|1|1|1|1|1|**7**|7|7|7|7|7|7|7|Xor|
181181

182-
ONNX-TF Supported Operators / ONNX Operators: 151 / 162
182+
ONNX-TF Supported Operators / ONNX Operators: 149 / 162
183183

184184
Notes:
185185
1. Cast: Cast string to data types other than float32/float64/int32/int64 is not supported in Tensorflow

onnx_tf/handlers/backend/cumsum.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
@tf_func(tf.math.cumsum)
1414
class CumSum(BackendHandler):
1515
cast_map = {tf.uint32: tf.int64}
16-
supported_types = [tf.int32, tf.int64, tf.float32, tf.float64]
16+
supported_types = [
17+
tf.int32, tf.int64, tf.float16, tf.float32, tf.float64, tf.bfloat16
18+
]
1719

1820
@classmethod
1921
def args_check(cls, node, **kwargs):
@@ -31,7 +33,7 @@ def args_check(cls, node, **kwargs):
3133
data_type.tf_to_np_str_list(cls.supported_types))
3234

3335
@classmethod
34-
def version_11(cls, node, **kwargs):
36+
def _common(cls, node, **kwargs):
3537
x = kwargs["tensor_dict"][node.inputs[0]]
3638

3739
# handle data types that are not natively supported by Tensorflow
@@ -51,3 +53,11 @@ def version_11(cls, node, **kwargs):
5153

5254
result = cls.make_tensor_from_onnx_node(node, inputs=inputs, attrs=attrs)
5355
return [tf.cast(result, dtype) if dtype in cls.cast_map else result]
56+
57+
@classmethod
58+
def version_11(cls, node, **kwargs):
59+
return cls._common(node, **kwargs)
60+
61+
@classmethod
62+
def version_14(cls, node, **kwargs):
63+
return cls._common(node, **kwargs)

onnx_tf/opset_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'ConvTranspose': [1, 11],
3535
'Cos': [7],
3636
'Cosh': [9],
37-
'CumSum': [11],
37+
'CumSum': [11, 14],
3838
'DepthToSpace': [1, 11, 13],
3939
'DequantizeLinear': [10, 13],
4040
'Det': [11],

0 commit comments

Comments
 (0)