onnx2tf 1.25.9__py3-none-any.whl → 1.25.11__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 +1 -1
- onnx2tf/ops/BatchNormalization.py +74 -67
- onnx2tf/ops/Flatten.py +14 -2
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/METADATA +3 -3
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/RECORD +10 -10
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/WHEEL +1 -1
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/LICENSE +0 -0
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/LICENSE_onnx-tensorflow +0 -0
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/entry_points.txt +0 -0
- {onnx2tf-1.25.9.dist-info → onnx2tf-1.25.11.dist-info}/top_level.txt +0 -0
onnx2tf/__init__.py
CHANGED
|
@@ -338,11 +338,17 @@ def make_node(
|
|
|
338
338
|
|
|
339
339
|
# Automatic correction of accuracy degradation
|
|
340
340
|
min_abs_err = sys.maxsize
|
|
341
|
-
min_abs_err_perm_1: List[int] = [
|
|
341
|
+
min_abs_err_perm_1: List[int] = []
|
|
342
|
+
check_length = 0
|
|
343
|
+
if input_tensor.shape is not None and mean.shape is not None and len(input_tensor.shape) >= len(mean.shape):
|
|
344
|
+
check_length = len(input_tensor.shape)
|
|
345
|
+
else:
|
|
346
|
+
check_length = len(mean.shape)
|
|
347
|
+
min_abs_err_perm_1: List[int] = [idx for idx in range(check_length)]
|
|
342
348
|
|
|
343
349
|
if not disable_strict_mode:
|
|
344
350
|
if onnx_tensor_infos is not None and validation_data is not None:
|
|
345
|
-
tensor_1_candidate_for_transpositions = list(itertools.permutations(range(
|
|
351
|
+
tensor_1_candidate_for_transpositions = list(itertools.permutations(range(check_length)))
|
|
346
352
|
# Search for the axis with the smallest error
|
|
347
353
|
for tensor_1_candidate_for_transposition in tensor_1_candidate_for_transpositions:
|
|
348
354
|
try:
|
|
@@ -470,71 +476,72 @@ def make_node(
|
|
|
470
476
|
except Exception as ex:
|
|
471
477
|
pass
|
|
472
478
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
479
|
+
if min_abs_err_perm_1 != [idx for idx in range(check_length)]:
|
|
480
|
+
tf_layers_dict[Y.name]['tf_node'] = \
|
|
481
|
+
tf.nn.batch_normalization(
|
|
482
|
+
x=input_tensor,
|
|
483
|
+
mean=\
|
|
484
|
+
transpose_with_flexing_deterrence(
|
|
485
|
+
input_tensor=mean,
|
|
486
|
+
perm=min_abs_err_perm_1,
|
|
487
|
+
output_shape=Y.shape \
|
|
488
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
489
|
+
**kwargs,
|
|
490
|
+
) if not isinstance(mean, np.ndarray) else \
|
|
491
|
+
transpose_with_flexing_deterrence(
|
|
492
|
+
input_tensor=tf.convert_to_tensor(mean),
|
|
493
|
+
perm=min_abs_err_perm_1,
|
|
494
|
+
output_shape=Y.shape \
|
|
495
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
496
|
+
**kwargs,
|
|
497
|
+
),
|
|
498
|
+
variance=\
|
|
499
|
+
transpose_with_flexing_deterrence(
|
|
500
|
+
input_tensor=var,
|
|
501
|
+
perm=min_abs_err_perm_1,
|
|
502
|
+
output_shape=Y.shape \
|
|
503
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
504
|
+
**kwargs,
|
|
505
|
+
) if not isinstance(var, np.ndarray) else \
|
|
506
|
+
transpose_with_flexing_deterrence(
|
|
507
|
+
input_tensor=tf.convert_to_tensor(var),
|
|
508
|
+
perm=min_abs_err_perm_1,
|
|
509
|
+
output_shape=Y.shape \
|
|
510
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
511
|
+
**kwargs,
|
|
512
|
+
),
|
|
513
|
+
offset=\
|
|
514
|
+
transpose_with_flexing_deterrence(
|
|
515
|
+
input_tensor=offset,
|
|
516
|
+
perm=min_abs_err_perm_1,
|
|
517
|
+
output_shape=Y.shape \
|
|
518
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
519
|
+
**kwargs,
|
|
520
|
+
) if not isinstance(offset, np.ndarray) else \
|
|
521
|
+
transpose_with_flexing_deterrence(
|
|
522
|
+
input_tensor=tf.convert_to_tensor(offset),
|
|
523
|
+
perm=min_abs_err_perm_1,
|
|
524
|
+
output_shape=Y.shape \
|
|
525
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
526
|
+
**kwargs,
|
|
527
|
+
),
|
|
528
|
+
scale=\
|
|
529
|
+
transpose_with_flexing_deterrence(
|
|
530
|
+
input_tensor=scale,
|
|
531
|
+
perm=min_abs_err_perm_1,
|
|
532
|
+
output_shape=Y.shape \
|
|
533
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
534
|
+
**kwargs,
|
|
535
|
+
) if not isinstance(scale, np.ndarray) else \
|
|
536
|
+
transpose_with_flexing_deterrence(
|
|
537
|
+
input_tensor=tf.convert_to_tensor(scale),
|
|
538
|
+
perm=min_abs_err_perm_1,
|
|
539
|
+
output_shape=Y.shape \
|
|
540
|
+
if None not in Y.shape and Y.shape != [] else None,
|
|
541
|
+
**kwargs,
|
|
542
|
+
),
|
|
543
|
+
variance_epsilon=epsilon,
|
|
544
|
+
)
|
|
538
545
|
tf_type = tf.nn.batch_normalization
|
|
539
546
|
|
|
540
547
|
# Post-process transpose
|
onnx2tf/ops/Flatten.py
CHANGED
|
@@ -87,8 +87,20 @@ def make_node(
|
|
|
87
87
|
cal_shape = (1, -1)
|
|
88
88
|
elif axis >= input_tensor_rank:
|
|
89
89
|
cal_shape = (-1, 1)
|
|
90
|
-
elif graph_node_output.shape is not None
|
|
91
|
-
|
|
90
|
+
elif graph_node_output.shape is not None \
|
|
91
|
+
and len(graph_node_output.shape) == 2 \
|
|
92
|
+
and axis == input_tensor_rank - 1 \
|
|
93
|
+
and not isinstance(graph_node_output.shape[0], str):
|
|
94
|
+
cal_shape = (graph_node_output.shape[0], -1)
|
|
95
|
+
elif graph_node_output.shape is not None \
|
|
96
|
+
and len(graph_node_output.shape) == 2 \
|
|
97
|
+
and axis == input_tensor_rank - 1 \
|
|
98
|
+
and isinstance(graph_node_output.shape[0], str):
|
|
99
|
+
try:
|
|
100
|
+
dim_prod = int(np.prod(graph_node_output.shape[1:]))
|
|
101
|
+
cal_shape = (-1, dim_prod)
|
|
102
|
+
except:
|
|
103
|
+
cal_shape = (1, -1)
|
|
92
104
|
elif input_tensor_rank >= 2 \
|
|
93
105
|
and input_tensor_shape[0] is None \
|
|
94
106
|
and len([idx for idx in input_tensor_shape[1:] if idx is not None]) == input_tensor_rank - 1 \
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: onnx2tf
|
|
3
|
-
Version: 1.25.
|
|
3
|
+
Version: 1.25.11
|
|
4
4
|
Summary: Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC). The purpose of this tool is to solve the massive Transpose extrapolation problem in onnx-tensorflow (onnx-tf).
|
|
5
5
|
Home-page: https://github.com/PINTO0309/onnx2tf
|
|
6
6
|
Author: Katsuya Hyodo
|
|
@@ -314,7 +314,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
314
314
|
docker run --rm -it \
|
|
315
315
|
-v `pwd`:/workdir \
|
|
316
316
|
-w /workdir \
|
|
317
|
-
ghcr.io/pinto0309/onnx2tf:1.25.
|
|
317
|
+
ghcr.io/pinto0309/onnx2tf:1.25.11
|
|
318
318
|
|
|
319
319
|
or
|
|
320
320
|
|
|
@@ -322,7 +322,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
322
322
|
docker run --rm -it \
|
|
323
323
|
-v `pwd`:/workdir \
|
|
324
324
|
-w /workdir \
|
|
325
|
-
docker.io/pinto0309/onnx2tf:1.25.
|
|
325
|
+
docker.io/pinto0309/onnx2tf:1.25.11
|
|
326
326
|
|
|
327
327
|
or
|
|
328
328
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
onnx2tf/__init__.py,sha256=
|
|
1
|
+
onnx2tf/__init__.py,sha256=5MSHOAaUsrACv9ZbUdjk6KkRgd52icO0_6Cu-6MEbio,67
|
|
2
2
|
onnx2tf/__main__.py,sha256=2RSCQ7d4lc6CwD-rlGn9UicPFg-P5du7ZD_yh-kuBEU,57
|
|
3
3
|
onnx2tf/onnx2tf.py,sha256=v7juKPrl_0h9SQyck-Ol4B59QXWSSePVC3AUu3fmvII,122750
|
|
4
4
|
onnx2tf/ops/Abs.py,sha256=V7btmCG_ZvK_qJovUsguq0ZMJ349mhNQ4FHSgzP_Yuo,4029
|
|
@@ -13,7 +13,7 @@ onnx2tf/ops/Asinh.py,sha256=74ZzTEkpxZY4CGfJT2JJU-SHXYL5KZeUkWY2v7hsMMw,3588
|
|
|
13
13
|
onnx2tf/ops/Atan.py,sha256=D24XDMxEwXFtJheQAr3V3IWOUOc6Q5M0-b_83bmGGMM,3981
|
|
14
14
|
onnx2tf/ops/Atanh.py,sha256=VsUYopBWWPoo4gta1_aqvUL6NrVXuVkGid4SqDqYJ9Q,3588
|
|
15
15
|
onnx2tf/ops/AveragePool.py,sha256=p9R4k87FO1yKZMQ699FIftXGUNKxb5yu0vYfzPlpsMA,14701
|
|
16
|
-
onnx2tf/ops/BatchNormalization.py,sha256=
|
|
16
|
+
onnx2tf/ops/BatchNormalization.py,sha256=_hlf2-5-j3MCJHEoE2oMNQ8YhCm7ad9h2fwPpTo3i7g,26624
|
|
17
17
|
onnx2tf/ops/Bernoulli.py,sha256=PM0xS0n1q4bnT_9PnbcKW8_Qj8dJYYBQR8kb2X-wIp4,3670
|
|
18
18
|
onnx2tf/ops/BitShift.py,sha256=a28_E9hwA8yfjvtsrSKCZCeeMPB5RBQbjB3cmaNGN6k,3861
|
|
19
19
|
onnx2tf/ops/Cast.py,sha256=iVSqSm1l_MXHtxUBRdQPJlzOTNRHcqMAPKi_LWaPYuc,4357
|
|
@@ -45,7 +45,7 @@ onnx2tf/ops/Erf.py,sha256=ayvSp8Pr9h-VYuIiMorwOC0r9aQ4i4S1Uvaho9R6PYo,4962
|
|
|
45
45
|
onnx2tf/ops/Exp.py,sha256=MM_Osse7UbJgld2u0fGMcjniJCs40uDztuOodVUqWMU,3583
|
|
46
46
|
onnx2tf/ops/Expand.py,sha256=MGsby7IhTqKv1K-1INQPHcI5l3Wx-jjJ1FnulpCZsag,14761
|
|
47
47
|
onnx2tf/ops/EyeLike.py,sha256=VHRlr_WpIGVpZSqfjN7zWQF6XT2KjNVJnjVccxB4P6U,5877
|
|
48
|
-
onnx2tf/ops/Flatten.py,sha256=
|
|
48
|
+
onnx2tf/ops/Flatten.py,sha256=skiXNi4cbh3XRzSm8eaT1vyjQ_8GdWDMT2mf3mB4eO8,6148
|
|
49
49
|
onnx2tf/ops/Floor.py,sha256=8izJrNmw8wNmjF_YabIpLs4jm82J-gKcyAQbwV7Yqpc,3589
|
|
50
50
|
onnx2tf/ops/FusedConv.py,sha256=gslI50V3yvt4l0mmodnyHFAu0cORx1J_ZL5cE0rZ8qs,4523
|
|
51
51
|
onnx2tf/ops/GRU.py,sha256=kBHiZlhlPIV2DQCoFYFHxCTwOATeguJy1MSfj2kxqDM,30732
|
|
@@ -188,10 +188,10 @@ onnx2tf/utils/__init__.py,sha256=E9FM9He68VIASDnYp-OrxvHFVn55GzWqw2OEkCqn1zg,27
|
|
|
188
188
|
onnx2tf/utils/common_functions.py,sha256=gCpAe11EcX-gYOMu68saIpIj20pDmLld-6jybnc_0aY,240691
|
|
189
189
|
onnx2tf/utils/enums.py,sha256=7c5TqetqB07VjyHoxJHfLgtqBqk9ZRyUF33fPOJR1IM,1649
|
|
190
190
|
onnx2tf/utils/logging.py,sha256=yUCmPuJ_XiUItM3sZMcaMO24JErkQy7zZwVTYWAuiKg,1982
|
|
191
|
-
onnx2tf-1.25.
|
|
192
|
-
onnx2tf-1.25.
|
|
193
|
-
onnx2tf-1.25.
|
|
194
|
-
onnx2tf-1.25.
|
|
195
|
-
onnx2tf-1.25.
|
|
196
|
-
onnx2tf-1.25.
|
|
197
|
-
onnx2tf-1.25.
|
|
191
|
+
onnx2tf-1.25.11.dist-info/LICENSE,sha256=5v_Kxihy8i6mzHVl349ikSREaIdsl9YeUnX1KBDLD2w,1070
|
|
192
|
+
onnx2tf-1.25.11.dist-info/LICENSE_onnx-tensorflow,sha256=gK4GtS9S5YcyINu6uuNNWdo-kBClyEM4MFLFGiNTeRM,11231
|
|
193
|
+
onnx2tf-1.25.11.dist-info/METADATA,sha256=JB5g2DWf3VLr17k4De6do-hCwzjEtMQDlMJOFBgl_fw,146191
|
|
194
|
+
onnx2tf-1.25.11.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
195
|
+
onnx2tf-1.25.11.dist-info/entry_points.txt,sha256=gDPK8ToCFPKMvm8jr9xrGOkXtORJJVh4736fBEKO5k0,41
|
|
196
|
+
onnx2tf-1.25.11.dist-info/top_level.txt,sha256=WgfPiEy3f6vZ_FOpAIEA2CF3TCx1eYrhGw93Ih6b9Fw,8
|
|
197
|
+
onnx2tf-1.25.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|