Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELAY][FRONTEND][OP] support repeat in ONNX #2849

Closed
XiaolongMeng opened this issue Mar 19, 2019 · 4 comments
Closed

[RELAY][FRONTEND][OP] support repeat in ONNX #2849

XiaolongMeng opened this issue Mar 19, 2019 · 4 comments

Comments

@XiaolongMeng
Copy link
Contributor

XiaolongMeng commented Mar 19, 2019

since it does not support tile op in onnx ,I write a convert, but it seems something wrong.

what I want to convert is
query = simple_cat.repeat(1, 100, 1)
which in pytorch.

what I add to onnx.py is

class Repeat(OnnxOpConverter):
    """ Operator converter for Repeat.
    """
    @classmethod
    def _impl_v1(cls, inputs, attr, params):
        repeats = tuple(params[inputs[1].name_hint].asnumpy())
        for i, repeat in enumerate(repeats):
            if repeat != 1:
                inputs[0] = _op.repeat(inputs[0], repeats=repeat, axis=i)
        return inputs[0]

and add this to _get_convert_map

but when I run
tvm_output = intrp.evaluate(sym)(inp, **params).asnumpy()

It occurred errors.

%4 = repeat(%3, meta[relay.attrs.RepeatAttrs][0]) # an internal invariant was violdated while typechecking your program [08:49:22] /notebooks/notebook/serving/tvm/include/tvm/expr_operator.h:535: cannot make const for type 80

Stack trace returned 10 entries:
[bt] (0) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x73fc4d) [0x7f6a81f8bc4d]
[bt] (1) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x74089d) [0x7f6a81f8c89d]
[bt] (2) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x77d62d) [0x7f6a81fc962d]
[bt] (3) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x77d716) [0x7f6a81fc9716]
[bt] (4) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xa6d3e9) [0x7f6a822b93e9]
[bt] (5) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xa59f74) [0x7f6a822a5f74]
[bt] (6) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xc2b087) [0x7f6a82477087]
[bt] (7) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xc45373) [0x7f6a82491373]
[bt] (8) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(tvm::relay::InferType(tvm::relay::Function const&, tvm::relay::Module const&, tvm::relay::GlobalVar const&)+0x32b) [0x7f6a824920db]
[bt] (9) /root/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xbb6720) [0x7f6a82402720]

so how can I fix this,thank you!

@XiaolongMeng XiaolongMeng changed the title tvm onnx frontend does not support repeat [RELAY]tvm onnx frontend does not support repeat Mar 19, 2019
@tqchen tqchen changed the title [RELAY]tvm onnx frontend does not support repeat [RELAY][FRONTEND][OP] tvm onnx frontend does not support repeat Mar 19, 2019
@tqchen tqchen changed the title [RELAY][FRONTEND][OP] tvm onnx frontend does not support repeat [RELAY][FRONTEND][OP] support repeat in ONNX Mar 19, 2019
@XiaolongMeng
Copy link
Contributor Author

emmm, I find what's wrong...It's the input shape, it must match the input name, I use 1,2,3, but in onnx,it's input.1, input.2..... so,maybe I can post a PR? @tqchen

@cchung100m
Copy link
Contributor

Hi @XiaolongMeng

I would appreciate if you can help to review the proposed PR.

many thank,

@XiaolongMeng
Copy link
Contributor Author

maybe you can call tqchen ...

@tqchen
Copy link
Member

tqchen commented Sep 20, 2019

#3941 thanks to @cchung100m

@tqchen tqchen closed this as completed Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants