onnx2tf 1.29.1__py3-none-any.whl → 1.29.2__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/Conv.py +27 -0
- onnx2tf/utils/json_auto_generator.py +190 -190
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/METADATA +3 -3
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/RECORD +9 -9
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/WHEEL +0 -0
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/licenses/LICENSE +0 -0
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/licenses/LICENSE_onnx-tensorflow +0 -0
- {onnx2tf-1.29.1.dist-info → onnx2tf-1.29.2.dist-info}/top_level.txt +0 -0
onnx2tf/__init__.py
CHANGED
onnx2tf/ops/Conv.py
CHANGED
|
@@ -370,6 +370,20 @@ def make_node(
|
|
|
370
370
|
)
|
|
371
371
|
|
|
372
372
|
def depth_conv_bias(input_tensor, input_weights, pad_mode, strides, dilations, input_bias):
|
|
373
|
+
# tf.nn.depthwise_conv2d uses a different output shape when dilation>1 and stride>1.
|
|
374
|
+
# Emulate stride>1 by running stride=1 then subsampling to match ONNX.
|
|
375
|
+
if pad_mode == 'VALID' \
|
|
376
|
+
and max(dilations) > 1 \
|
|
377
|
+
and any(s > 1 for s in strides[1:-1]):
|
|
378
|
+
conv = tf.nn.depthwise_conv2d(
|
|
379
|
+
input=input_tensor,
|
|
380
|
+
filter=input_weights,
|
|
381
|
+
padding=pad_mode,
|
|
382
|
+
strides=[1, 1, 1, 1],
|
|
383
|
+
dilations=dilations,
|
|
384
|
+
)
|
|
385
|
+
conv = conv[:, ::strides[1], ::strides[2], :]
|
|
386
|
+
return tf.add(conv, input_bias)
|
|
373
387
|
return \
|
|
374
388
|
tf.add(
|
|
375
389
|
tf.nn.depthwise_conv2d(
|
|
@@ -438,6 +452,19 @@ def make_node(
|
|
|
438
452
|
)
|
|
439
453
|
|
|
440
454
|
def depth_conv_nobias(input_tensor, input_weights, pad_mode, strides, dilations):
|
|
455
|
+
# tf.nn.depthwise_conv2d uses a different output shape when dilation>1 and stride>1.
|
|
456
|
+
# Emulate stride>1 by running stride=1 then subsampling to match ONNX.
|
|
457
|
+
if pad_mode == 'VALID' \
|
|
458
|
+
and max(dilations) > 1 \
|
|
459
|
+
and any(s > 1 for s in strides[1:-1]):
|
|
460
|
+
conv = tf.nn.depthwise_conv2d(
|
|
461
|
+
input=input_tensor,
|
|
462
|
+
filter=input_weights,
|
|
463
|
+
padding=pad_mode,
|
|
464
|
+
strides=[1, 1, 1, 1],
|
|
465
|
+
dilations=dilations,
|
|
466
|
+
)
|
|
467
|
+
return conv[:, ::strides[1], ::strides[2], :]
|
|
441
468
|
return \
|
|
442
469
|
tf.nn.depthwise_conv2d(
|
|
443
470
|
input=input_tensor,
|