Skip to content

[Feature] Support for 1D Convolution #4587

@antimora

Description

@antimora

I was trying to import my ONNX model but it has failed with the following error:

$ /usr/bin/python3 /workspace/trouble_onnx.py
Traceback (most recent call last):

  File "/workspace/trouble_onnx.py", line 15, in <module>
    mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)

  File "/workspace/python/tvm/relay/frontend/onnx.py", line 1553, in from_onnx
    mod, params = g.from_onnx(graph, opset)

  File "/workspace/python/tvm/relay/frontend/onnx.py", line 1381, in from_onnx
    op = self._convert_operator(op_name, inputs, attr, opset)

  File "/workspace/python/tvm/relay/frontend/onnx.py", line 1481, in _convert_operator
    sym = convert_map[op_name](inputs, attrs, self._params)

  File "/workspace/python/tvm/relay/frontend/onnx.py", line 246, in _impl_v1
    custom_check=dimension_constraint())(inputs[:2], attr, params)

  File "/workspace/python/tvm/relay/frontend/common.py", line 377, in __call__
    raise RuntimeError("Check failed: {}".format(msg))

RuntimeError: Check failed: Only 2d kernel supported.

Code is the latest version (master@1900041447cc7fd4f23a857c4839acbf74cd890c) as of now.

I noticed @tqchen closed this related issue #3518 recently but not explanation was given. Could it be because this related PR was merged?

I would really love if TVM adds 1D Conv support. It would be tremendous for speech processing projects.

To help with debugging and development, I am attaching onnx model and graph image.
trouble.zip

You can run the following python code to reproduce an error:

import onnx
import numpy as np
import tvm.relay as relay

onnx_model = onnx.load('trouble.onnx')

input1 = np.random.rand(1, 192, 100)
input2 = np.random.rand(1)

shape_dict = {'1': input1.shape, 'x.1': input2.shape}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions