onnx2tf 1.29.4__py3-none-any.whl → 1.29.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
onnx2tf/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from onnx2tf.onnx2tf import convert, main
2
2
 
3
- __version__ = '1.29.4'
3
+ __version__ = '1.29.5'
onnx2tf/ops/CumProd.py ADDED
@@ -0,0 +1,127 @@
1
+ import random
2
+ random.seed(0)
3
+ import numpy as np
4
+ np.random.seed(0)
5
+ import tensorflow as tf
6
+ import onnx_graphsurgeon as gs
7
+ from onnx2tf.utils.common_functions import (
8
+ get_constant_or_variable,
9
+ print_node_info,
10
+ inverted_operation_enable_disable,
11
+ make_tf_node_info,
12
+ get_replacement_parameter,
13
+ pre_process_transpose,
14
+ post_process_transpose,
15
+ )
16
+
17
+
18
+ @print_node_info
19
+ @inverted_operation_enable_disable
20
+ @get_replacement_parameter
21
+ def make_node(
22
+ *,
23
+ graph_node: gs.Node,
24
+ tf_layers_dict: dict,
25
+ **kwargs: dict,
26
+ ):
27
+ """CumProd
28
+
29
+ Parameters
30
+ ----------
31
+ graph_node: gs.Node
32
+ graph_surgeon Node
33
+
34
+ tf_layers_dict: dict
35
+ optype, shape, dtype, tensorflow graph
36
+ """
37
+ before_op_output_shape_trans_1 = \
38
+ tf_layers_dict.get(graph_node.inputs[0].name, {}).get('before_op_output_shape_trans', True)
39
+ before_op_output_shape_trans_2 = \
40
+ tf_layers_dict.get(graph_node.inputs[1].name, {}).get('before_op_output_shape_trans', True)
41
+ before_op_output_shape_trans = \
42
+ before_op_output_shape_trans_1 \
43
+ and before_op_output_shape_trans_2
44
+
45
+ graph_node_input_1 = get_constant_or_variable(
46
+ graph_node.inputs[0],
47
+ before_op_output_shape_trans,
48
+ )
49
+ graph_node_input_2 = get_constant_or_variable(
50
+ graph_node.inputs[1],
51
+ before_op_output_shape_trans,
52
+ )
53
+
54
+ input_tensor = tf_layers_dict[graph_node_input_1.name]['tf_node'] \
55
+ if isinstance(graph_node_input_1, gs.Variable) else graph_node_input_1
56
+ input_tensor_dtype = input_tensor.dtype
57
+ axis = tf_layers_dict[graph_node_input_2.name]['tf_node'] \
58
+ if isinstance(graph_node_input_2, gs.Variable) else graph_node_input_2
59
+
60
+ graph_node_output: gs.Variable = graph_node.outputs[0]
61
+
62
+ shape = graph_node_output.shape
63
+ dtype = graph_node_output.dtype
64
+
65
+ exclusive = bool(graph_node.attrs.get('exclusive', 0))
66
+ reverse = bool(graph_node.attrs.get('reverse', 0))
67
+
68
+ # Preserving Graph Structure (Dict)
69
+ tf_layers_dict[graph_node_output.name] = {
70
+ 'optype': graph_node.op,
71
+ 'shape': shape,
72
+ 'dtype': dtype,
73
+ }
74
+
75
+ # Pre-process transpose
76
+ input_tensor = pre_process_transpose(
77
+ value_before_transpose=input_tensor,
78
+ param_target='inputs',
79
+ param_name=graph_node.inputs[0].name,
80
+ **kwargs,
81
+ )
82
+
83
+ # TensorFlow's cumsum does not support boolean,
84
+ # so temporarily cast to INT32 for calculation.
85
+ if input_tensor_dtype == tf.bool:
86
+ input_tensor = tf.cast(input_tensor, dtype=tf.int32)
87
+
88
+ # Generation of TF OP
89
+ tf_layers_dict[graph_node_output.name]['tf_node'] = \
90
+ tf.math.cumprod(
91
+ x=input_tensor,
92
+ axis=axis,
93
+ exclusive=exclusive,
94
+ reverse=reverse,
95
+ name=graph_node.name,
96
+ )
97
+
98
+ # TensorFlow's cumsum does not support boolean,
99
+ # so INT32 is converted back to boolean.
100
+ if input_tensor_dtype == tf.bool:
101
+ tf_layers_dict[graph_node_output.name]['tf_node'] = \
102
+ tf.cast(tf_layers_dict[graph_node_output.name]['tf_node'], dtype=tf.bool)
103
+
104
+ # Post-process transpose
105
+ tf_layers_dict[graph_node_output.name]['tf_node'] = post_process_transpose(
106
+ value_before_transpose=tf_layers_dict[graph_node_output.name]['tf_node'],
107
+ param_target='outputs',
108
+ param_name=graph_node.outputs[0].name,
109
+ **kwargs,
110
+ )
111
+
112
+ # Generation of Debug Info
113
+ tf_layers_dict[graph_node_output.name]['tf_node_info'] = \
114
+ make_tf_node_info(
115
+ node_info={
116
+ 'tf_op_type': tf.math.cumprod,
117
+ 'tf_inputs': {
118
+ 'x': input_tensor,
119
+ 'axis': axis,
120
+ 'exclusive': exclusive,
121
+ 'reverse': reverse,
122
+ },
123
+ 'tf_outputs': {
124
+ 'output': tf_layers_dict[graph_node_output.name]['tf_node'],
125
+ },
126
+ }
127
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onnx2tf
3
- Version: 1.29.4
3
+ Version: 1.29.5
4
4
  Summary: Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC).
5
5
  Home-page: https://github.com/PINTO0309/onnx2tf
6
6
  Author: Katsuya Hyodo
@@ -95,6 +95,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
95
95
  |Acosh|:heavy_check_mark:|
96
96
  |Acos|:heavy_check_mark:|
97
97
  |Add|:heavy_check_mark:|
98
+ |AffineGrid|**Help wanted**|
98
99
  |And|:heavy_check_mark:|
99
100
  |ArgMax|:heavy_check_mark:|
100
101
  |ArgMin|:heavy_check_mark:|
@@ -102,6 +103,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
102
103
  |Asin|:heavy_check_mark:|
103
104
  |Atanh|:heavy_check_mark:|
104
105
  |Atan|:heavy_check_mark:|
106
+ |Attention|**Help wanted**|
105
107
  |AveragePool|:heavy_check_mark:|
106
108
  |BatchNormalization|:heavy_check_mark:|
107
109
  |Bernoulli|:heavy_check_mark:|
@@ -110,6 +112,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
110
112
  |BitwiseNot|:heavy_check_mark:|
111
113
  |BitwiseOr|:heavy_check_mark:|
112
114
  |BitwiseXor|:heavy_check_mark:|
115
+ |BlackmanWindow|**Help wanted**|
113
116
  |Cast|:heavy_check_mark:|
114
117
  |Ceil|:heavy_check_mark:|
115
118
  |Celu|:heavy_check_mark:|
@@ -126,6 +129,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
126
129
  |ConvTranspose|:heavy_check_mark:|
127
130
  |Cosh|:heavy_check_mark:|
128
131
  |Cos|:heavy_check_mark:|
132
+ |CumProd|:heavy_check_mark:|
129
133
  |CumSum|:heavy_check_mark:|
130
134
  |DeformConv|**Help wanted**|
131
135
  |DepthToSpace|:heavy_check_mark:|
@@ -165,6 +169,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
165
169
  |HardSwish|:heavy_check_mark:|
166
170
  |Identity|:heavy_check_mark:|
167
171
  |If|:heavy_check_mark:|
172
+ |ImageDecoder|**Help wanted**|
168
173
  |Input|:heavy_check_mark:|
169
174
  |InstanceNormalization|:heavy_check_mark:|
170
175
  |Inverse|:heavy_check_mark:|
@@ -178,6 +183,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
178
183
  |LogSoftmax|:heavy_check_mark:|
179
184
  |Loop|**Help wanted**|
180
185
  |LpNormalization|:heavy_check_mark:|
186
+ |LpPool|**Help wanted**|
181
187
  |LRN|:heavy_check_mark:|
182
188
  |LSTM|:heavy_check_mark:|
183
189
  |MatMul|:heavy_check_mark:|
@@ -195,6 +201,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
195
201
  |Mul|:heavy_check_mark:|
196
202
  |Multinomial|:heavy_check_mark:|
197
203
  |Neg|:heavy_check_mark:|
204
+ |NegativeLogLikelihoodLoss|**Help wanted**|
198
205
  |NonMaxSuppression|:heavy_check_mark:|
199
206
  |NonZero|:heavy_check_mark:|
200
207
  |Optional|**Help wanted**|
@@ -237,6 +244,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
237
244
  |ReverseSequence|:heavy_check_mark:|
238
245
  |RNN|:heavy_check_mark:|
239
246
  |RoiAlign|:heavy_check_mark:|
247
+ |RotaryEmbedding|**Help wanted**|
240
248
  |Round|:heavy_check_mark:|
241
249
  |ScaleAndTranslate|:heavy_check_mark:|
242
250
  |Scatter|:heavy_check_mark:|
@@ -259,6 +267,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
259
267
  |Size|:heavy_check_mark:|
260
268
  |Slice|:heavy_check_mark:|
261
269
  |Softmax|:heavy_check_mark:|
270
+ |SoftmaxCrossEntropyLoss|**Help wanted**|
262
271
  |Softplus|:heavy_check_mark:|
263
272
  |Softsign|:heavy_check_mark:|
264
273
  |SpaceToDepth|:heavy_check_mark:|
@@ -267,11 +276,14 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
267
276
  |Sqrt|:heavy_check_mark:|
268
277
  |Squeeze|:heavy_check_mark:|
269
278
  |STFT|:white_check_mark:|
279
+ |StringConcat|**Help wanted**|
270
280
  |StringNormalizer|:white_check_mark:|
281
+ |StringSplit|**Help wanted**|
271
282
  |Sub|:heavy_check_mark:|
272
283
  |Sum|:heavy_check_mark:|
273
- |Tanh|:heavy_check_mark:|
274
284
  |Tan|:heavy_check_mark:|
285
+ |Tanh|:heavy_check_mark:|
286
+ |TensorScatter|**Help wanted**|
275
287
  |TfIdfVectorizer|**Help wanted**|
276
288
  |ThresholdedRelu|:heavy_check_mark:|
277
289
  |Tile|:heavy_check_mark:|
@@ -292,11 +304,11 @@ Video speed is adjusted approximately 50 times slower than actual speed.
292
304
 
293
305
  ## Environment
294
306
  - Linux / Windows
295
- - onnx==1.17.0
296
- - onnxruntime==1.18.1
307
+ - onnx==1.19.0
308
+ - onnxruntime==1.23.0
297
309
  - onnx-simplifier==0.4.33 or 0.4.30 `(onnx.onnx_cpp2py_export.shape_inference.InferenceError: [ShapeInferenceError] (op_type:Slice, node name: /xxxx/Slice): [ShapeInferenceError] Inferred shape and existing shape differ in rank: (x) vs (y))`
298
- - onnx_graphsurgeon
299
- - simple_onnx_processing_tools
310
+ - onnx_graphsurgeon==0.5.8
311
+ - simple_onnx_processing_tools==1.1.32
300
312
  - tensorflow==2.19.0, Special bugs: [#436](https://github.com/PINTO0309/onnx2tf/issues/436)
301
313
  - tf-keras==2.19.0
302
314
  - ai-edge-litert==1.2.0
@@ -345,7 +357,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
345
357
  docker run --rm -it \
346
358
  -v `pwd`:/workdir \
347
359
  -w /workdir \
348
- ghcr.io/pinto0309/onnx2tf:1.29.4
360
+ ghcr.io/pinto0309/onnx2tf:1.29.5
349
361
 
350
362
  or
351
363
 
@@ -353,15 +365,15 @@ Video speed is adjusted approximately 50 times slower than actual speed.
353
365
  docker run --rm -it \
354
366
  -v `pwd`:/workdir \
355
367
  -w /workdir \
356
- docker.io/pinto0309/onnx2tf:1.29.4
368
+ docker.io/pinto0309/onnx2tf:1.29.5
357
369
 
358
370
  or
359
371
 
360
- pip install -U onnx==1.17.0 \
361
- && pip install -U onnx-graphsurgeon \
362
- && pip install -U onnxruntime==1.18.1 \
372
+ pip install -U onnx==1.19.0 \
373
+ && pip install -U onnx-graphsurgeon==0.5.8 \
374
+ && pip install -U onnxruntime==1.23.0 \
363
375
  && pip install -U onnxsim==0.4.33 \
364
- && pip install -U simple_onnx_processing_tools \
376
+ && pip install -U simple_onnx_processing_tools==1.1.32 \
365
377
  && pip install -U sne4onnx>=1.0.13 \
366
378
  && pip install -U sng4onnx>=1.0.4 \
367
379
  && pip install -U ai_edge_litert==1.2.0 \
@@ -397,7 +409,7 @@ or
397
409
  !pip install -U pip \
398
410
  && pip install tensorflow==2.19.0 \
399
411
  && pip install ai_edge_litert==1.2.0 \
400
- && pip install -U onnx==1.17.0 \
412
+ && pip install -U onnx==1.19.0 \
401
413
  && python -m pip install onnx_graphsurgeon \
402
414
  --index-url https://pypi.ngc.nvidia.com \
403
415
  && pip install -U onnxruntime==1.18.1 \
@@ -1,4 +1,4 @@
1
- onnx2tf/__init__.py,sha256=pluvSdvaC9nePqUVOCSAuPcchjfddyLkq1cJnhohl5w,66
1
+ onnx2tf/__init__.py,sha256=Q0W9h6HaC_Ln39vo1FoV-1h8VnPLA9bqc2HhgI7rS7w,66
2
2
  onnx2tf/__main__.py,sha256=2RSCQ7d4lc6CwD-rlGn9UicPFg-P5du7ZD_yh-kuBEU,57
3
3
  onnx2tf/onnx2tf.py,sha256=wdBA-lgCEu-ZfUAKIUQgLe8hSP8ifE7rS6nWAq6iF6o,151519
4
4
  onnx2tf/ops/Abs.py,sha256=V7btmCG_ZvK_qJovUsguq0ZMJ349mhNQ4FHSgzP_Yuo,4029
@@ -35,6 +35,7 @@ onnx2tf/ops/ConvInteger.py,sha256=UVHy1de6uCLM7IXP4vpzPz2pN2ej278lGBiqTPNdXFA,26
35
35
  onnx2tf/ops/ConvTranspose.py,sha256=C7CR6m3kz0MtUBdtWrrKWZbZL7tJpGXl7Nkn3DRiEaA,15410
36
36
  onnx2tf/ops/Cos.py,sha256=0v5ZJZRzrswVEObyxf4f0RvnWMWZA4uCEdoeq_VE31s,3608
37
37
  onnx2tf/ops/Cosh.py,sha256=-L3QkQtiVBJIv1sSxbXtetVIwgI_2T4WC1O4t2aJ8Gc,3585
38
+ onnx2tf/ops/CumProd.py,sha256=k4hTEQrkwS7vk7pEy2Btvy2y0o70NlWj1MgsNomfOPg,3957
38
39
  onnx2tf/ops/CumSum.py,sha256=SYKmD5r9Cm9gsCkJPNFoHigvvBO1PmRYRrVmn1HE78o,3954
39
40
  onnx2tf/ops/DepthToSpace.py,sha256=BiyBZ88dmXQAkZ5Jc-Ddo-5Kn8dRYCnoik_XnOFzqXc,14449
40
41
  onnx2tf/ops/DequantizeLinear.py,sha256=cNbGw4ITg_BsrXYkSb7fD05XEkQgz7v__-StQtvIvB4,5220
@@ -194,9 +195,9 @@ onnx2tf/utils/enums.py,sha256=7c5TqetqB07VjyHoxJHfLgtqBqk9ZRyUF33fPOJR1IM,1649
194
195
  onnx2tf/utils/iterative_json_optimizer.py,sha256=qqeIxWGxrhcCYk8-ebWnblnOkzDCwi-nseipHzHR_bk,10436
195
196
  onnx2tf/utils/json_auto_generator.py,sha256=OC-SfKtUg7zUxaXTAg6kT0ShzIc3ByjDa3FNp173DtA,60302
196
197
  onnx2tf/utils/logging.py,sha256=yUCmPuJ_XiUItM3sZMcaMO24JErkQy7zZwVTYWAuiKg,1982
197
- onnx2tf-1.29.4.dist-info/licenses/LICENSE,sha256=5v_Kxihy8i6mzHVl349ikSREaIdsl9YeUnX1KBDLD2w,1070
198
- onnx2tf-1.29.4.dist-info/licenses/LICENSE_onnx-tensorflow,sha256=gK4GtS9S5YcyINu6uuNNWdo-kBClyEM4MFLFGiNTeRM,11231
199
- onnx2tf-1.29.4.dist-info/METADATA,sha256=HYGQZOLfX2Hvk0xSg3t8Dfd376S7WlGyAc16CEfQztM,153246
200
- onnx2tf-1.29.4.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
201
- onnx2tf-1.29.4.dist-info/top_level.txt,sha256=WgfPiEy3f6vZ_FOpAIEA2CF3TCx1eYrhGw93Ih6b9Fw,8
202
- onnx2tf-1.29.4.dist-info/RECORD,,
198
+ onnx2tf-1.29.5.dist-info/licenses/LICENSE,sha256=5v_Kxihy8i6mzHVl349ikSREaIdsl9YeUnX1KBDLD2w,1070
199
+ onnx2tf-1.29.5.dist-info/licenses/LICENSE_onnx-tensorflow,sha256=gK4GtS9S5YcyINu6uuNNWdo-kBClyEM4MFLFGiNTeRM,11231
200
+ onnx2tf-1.29.5.dist-info/METADATA,sha256=DNS6D_TBgXo1oDBQro5G-cirZniYhPvUdjCehba_IVo,153688
201
+ onnx2tf-1.29.5.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
202
+ onnx2tf-1.29.5.dist-info/top_level.txt,sha256=WgfPiEy3f6vZ_FOpAIEA2CF3TCx1eYrhGw93Ih6b9Fw,8
203
+ onnx2tf-1.29.5.dist-info/RECORD,,