You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2020/07/06 02:38:42 UTC

[incubator-tvm] branch master updated: [Relay][Frontend][Onnx] Small bug fix for Conv1D imports. (#5995)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new a64feed  [Relay][Frontend][Onnx] Small bug fix for Conv1D imports. (#5995)
a64feed is described below

commit a64feedd88783d8bed163f6cfd7b792e292c8a39
Author: Josh Fromm <jw...@uw.edu>
AuthorDate: Sun Jul 5 19:38:31 2020 -0700

    [Relay][Frontend][Onnx] Small bug fix for Conv1D imports. (#5995)
    
    * Fix autopad bug in onnx importer for conv1d.
    
    * Fix output shape in test.
    
    * Undo commented out lines oops.
---
 python/tvm/relay/op/nn/nn.py               | 3 +--
 tests/python/frontend/onnx/test_forward.py | 9 +++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/python/tvm/relay/op/nn/nn.py b/python/tvm/relay/op/nn/nn.py
index e5009d3..6ede0be 100644
--- a/python/tvm/relay/op/nn/nn.py
+++ b/python/tvm/relay/op/nn/nn.py
@@ -108,8 +108,7 @@ def conv1d(data,
         strides = (strides, )
     if isinstance(dilation, int):
         dilation = (dilation, )
-    if isinstance(padding, int):
-        padding = (padding, padding)
+    padding = get_pad_tuple1d(padding)
     return _make.conv1d(data, weight, strides, padding, dilation,
                         groups, channels, kernel_size, data_layout,
                         kernel_layout, out_layout, out_dtype)
diff --git a/tests/python/frontend/onnx/test_forward.py b/tests/python/frontend/onnx/test_forward.py
index d9c481a..5c472be 100644
--- a/tests/python/frontend/onnx/test_forward.py
+++ b/tests/python/frontend/onnx/test_forward.py
@@ -2180,6 +2180,15 @@ def test_conv():
                     repeat(1, D),
                     repeat(1, D),
                     auto_pad="SAME_UPPER")
+        # Convolution with valid autopadding
+        verify_conv((1, 1) + repeat(5, D),
+                    (1, 1) + repeat(3, D),
+                    (1, 1) + repeat(3, D),
+                    None,
+                    repeat(3, D),
+                    repeat(1, D),
+                    repeat(1, D),
+                    auto_pad="VALID")
         # Convolution with unset padding
         verify_conv((1, 1) + repeat(5, D),
                     (1, 1) + repeat(3, D),