Skip to content

[Relay][ONNX]Import ONNX model to inference failed #3079

@aitest11

Description

@aitest11

When I use ONNX model to inference , such as from_onnx.py(https://docs.tvm.ai/tutorials/frontend/from_onnx.html), I find these issue :

Traceback (most recent call last):
File "from_onnx.py", line 98, in
**tvm_output = intrp.evaluate(sym)(tvm.nd.array(x.astype(dtype)), params).asnumpy()
......
%0 = divide(%Input73, %Constant377) //
%1 = nn.conv2d(%0, %Constant321, kernel_size=[5, 5]) // an internal invariant was violdated while typechecking your program [15:47:10] /tvm/src/lang/data_layout.cc:273: Check failed: src_shape.size() == src_axis.size() (0 vs. 4) :
;
%2 = reshape(%Constant318, newshape=[8, 1, 1]) //
%3 = reshape(%2, newshape=[8]) //
%4 = expand_dims(%3, axis=1, num_newaxis=2) //
%5 = add(%1, %4) //
%6 = nn.relu(%5) //
%7 = nn.max_pool2d(%6, pool_size=[2, 2], strides=[2, 2]) // an internal invariant was violdated while typechecking your program [15:47:10] /tvm/src/relay/op/nn/pooling.cc:73: Check failed: data != nullptr:
;
%8 = nn.conv2d(%7, %Constant340, kernel_size=[5, 5]) //
%9 = reshape(%Constant346, newshape=[16, 1, 1]) //
%10 = reshape(%9, newshape=[16]) //
%11 = expand_dims(%10, axis=1, num_newaxis=2) //
%12 = add(%8, %11) //
%13 = nn.relu(%12) //
%14 = nn.max_pool2d(%13, pool_size=[3, 3], strides=[3, 3]) // an internal invariant was violdated while typechecking your program [15:47:10] /tvm/src/relay/op/nn/pooling.cc:73: Check failed: data != nullptr:
;
%15 = reshape(%14, newshape=[1, 256]) //
%16 = reshape(%Constant312, newshape=[256, 10]) //
%17 = transpose(%16, axes=[1, 0]) //
%18 = nn.dense(%15, %17, units=None) //
%19 = reshape(%Constant367, newshape=[10]) //
%20 = add(%18, %19) //
%20

I don,t know what errors happened when I use it.

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