TVMError: Check failed: type_code_ == kDLFloat (8 vs. 2) : expected float but get Object

I got the following error while loading onnx model:

/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/onnx.py:1853: UserWarning: Node () has input size 3 not in range [min=1, max=1].

==> Context: Bad node spec: input: "369" input: "370" input: "371" output: "372" op_type: "Clip"
  warnings.warn(str(e))
WARNING:root:Attribute momentum is ignored in relay.sym.batch_norm
Traceback (most recent call last):

  File "to_tvm.py", line 18, in <module>
    mod, params = relay.frontend.from_onnx(model,shape_dict)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/onnx.py", line 1863, in from_onnx
    mod, params = g.from_onnx(graph, opset)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/onnx.py", line 1691, in from_onnx
    op = self._convert_operator(op_name, inputs, attr, opset)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/onnx.py", line 1791, in _convert_operator
    sym = convert_map[op_name](inputs, attrs, self._params)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/common.py", line 415, in __call__
    return get_relay_op(op_name)(*inputs, **new_attrs)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/relay/op/tensor.py", line 854, in clip
    return _make.clip(a, a_min, a_max)

  File "/home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/_ctypes/packed_func.py", line 213, in __call__
    raise get_last_ffi_error()

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (3) /home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(TVMFuncCall+0x65) [0x7f8a45d78e05]
  [bt] (2) /home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(+0x8bfd8b) [0x7f8a45b00d8b]
  [bt] (1) /home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(tvm::runtime::TVMPODValue_::operator double() const+0x470) [0x7f8a456d3d60]
  [bt] (0) /home/dai/py37env/lib/python3.7/site-packages/tvm-0.7.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x43) [0x7f8a45598483]
  File "/home/dai/library/git_repositories/incubator-tvm/include/tvm/runtime/packed_func.h", line 421
TVMError: Check failed: type_code_ == kDLFloat (8 vs. 2) : expected float but get Object

And my code is as follows:

import torch
import onnx
import numpy as np
import tvm
import tvm.relay as relay
from tvm.contrib.download import download_testdata

dummy_input = torch.randn((1,3,640,640))

model = onnx.load("/home/dai/scripts/east_deploy/east.onnx")


target = "llvm"
input_name = "input.1"
shape_dict = {input_name:dummy_input.shape}
mod, params = relay.frontend.from_onnx(model,shape_dict)

How can I find the solution?

Please tell me if more detail is needed.

It would be helpful to know see the ONNX graph for the model. The problem is when parsing the graph and converting some ONNX op to Relay clip op, one of the bounds (a_min, a_max) is not a float. To debug, I would check the inputs here: https://github.com/apache/incubator-tvm/blob/master/python/tvm/relay/op/tensor.py#L829 with the ONNX graph to see why that is happening.

Thankyou, Here is part of the onnx graph for this model is like this ( the reply is limited to 32000 characters, so I couldn’t paste all the onnx graph):

graph(%input.1 : Float(1, 3, 640, 640),
      %extractor.features.0.0.weight : Float(32, 3, 3, 3),
      %extractor.features.0.1.weight : Float(32),
      %extractor.features.0.1.bias : Float(32),
      %extractor.features.0.1.running_mean : Float(32),
      %extractor.features.0.1.running_var : Float(32),
      %extractor.features.0.1.num_batches_tracked : Long(),
      %extractor.features.1.conv.0.0.weight : Float(32, 1, 3, 3),
      %extractor.features.1.conv.0.1.weight : Float(32),
      ...
      ...
      ... 
      %output.conv1.weight : Float(1, 32, 1, 1),
      %output.conv1.bias : Float(1),
      %output.conv2.weight : Float(4, 32, 1, 1),
      %output.conv2.bias : Float(4),
      %output.conv3.weight : Float(1, 32, 1, 1),
      %output.conv3.bias : Float(1)):
  %368 : Float(1, 32, 320, 320) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2]](%input.1, %extractor.features.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %369 : Float(1, 32, 320, 320) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%368, %extractor.features.0.1.weight, %extractor.features.0.1.bias, %extractor.features.0.1.running_mean, %extractor.features.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %370 : Tensor = onnx::Constant[value={0}]()
  %371 : Tensor = onnx::Constant[value={6}]()
  %372 : Float(1, 32, 320, 320) = onnx::Clip(%369, %370, %371) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %373 : Float(1, 32, 320, 320) = onnx::Conv[dilations=[1, 1], group=32, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%372, %extractor.features.1.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %374 : Float(1, 32, 320, 320) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%373, %extractor.features.1.conv.0.1.weight, %extractor.features.1.conv.0.1.bias, %extractor.features.1.conv.0.1.running_mean, %extractor.features.1.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %375 : Tensor = onnx::Constant[value={0}]()
  %376 : Tensor = onnx::Constant[value={6}]()
  %377 : Float(1, 32, 320, 320) = onnx::Clip(%374, %375, %376) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %378 : Float(1, 16, 320, 320) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%377, %extractor.features.1.conv.1.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %379 : Float(1, 16, 320, 320) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%378, %extractor.features.1.conv.2.weight, %extractor.features.1.conv.2.bias, %extractor.features.1.conv.2.running_mean, %extractor.features.1.conv.2.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %380 : Float(1, 96, 320, 320) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%379, %extractor.features.2.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %381 : Float(1, 96, 320, 320) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%380, %extractor.features.2.conv.0.1.weight, %extractor.features.2.conv.0.1.bias, %extractor.features.2.conv.0.1.running_mean, %extractor.features.2.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %382 : Tensor = onnx::Constant[value={0}]()
  %383 : Tensor = onnx::Constant[value={6}]()
  %384 : Float(1, 96, 320, 320) = onnx::Clip(%381, %382, %383) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %385 : Float(1, 96, 160, 160) = onnx::Conv[dilations=[1, 1], group=96, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2]](%384, %extractor.features.2.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %386 : Float(1, 96, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%385, %extractor.features.2.conv.1.1.weight, %extractor.features.2.conv.1.1.bias, %extractor.features.2.conv.1.1.running_mean, %extractor.features.2.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %387 : Tensor = onnx::Constant[value={0}]()
  %388 : Tensor = onnx::Constant[value={6}]()
  %389 : Float(1, 96, 160, 160) = onnx::Clip(%386, %387, %388) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %390 : Float(1, 24, 160, 160) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%389, %extractor.features.2.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %391 : Float(1, 24, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%390, %extractor.features.2.conv.3.weight, %extractor.features.2.conv.3.bias, %extractor.features.2.conv.3.running_mean, %extractor.features.2.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %392 : Float(1, 144, 160, 160) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%391, %extractor.features.3.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %393 : Float(1, 144, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%392, %extractor.features.3.conv.0.1.weight, %extractor.features.3.conv.0.1.bias, %extractor.features.3.conv.0.1.running_mean, %extractor.features.3.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %394 : Tensor = onnx::Constant[value={0}]()
  %395 : Tensor = onnx::Constant[value={6}]()
  %396 : Float(1, 144, 160, 160) = onnx::Clip(%393, %394, %395) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %397 : Float(1, 144, 160, 160) = onnx::Conv[dilations=[1, 1], group=144, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%396, %extractor.features.3.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %398 : Float(1, 144, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%397, %extractor.features.3.conv.1.1.weight, %extractor.features.3.conv.1.1.bias, %extractor.features.3.conv.1.1.running_mean, %extractor.features.3.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %399 : Tensor = onnx::Constant[value={0}]()
  %400 : Tensor = onnx::Constant[value={6}]()
  %401 : Float(1, 144, 160, 160) = onnx::Clip(%398, %399, %400) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %402 : Float(1, 24, 160, 160) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%401, %extractor.features.3.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %403 : Float(1, 24, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%402, %extractor.features.3.conv.3.weight, %extractor.features.3.conv.3.bias, %extractor.features.3.conv.3.running_mean, %extractor.features.3.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %404 : Float(1, 24, 160, 160) = onnx::Add(%391, %403) # /home/dai/py37env/lib/python3.7/site-packages/torchvision/models/mobilenet.py:67:0
  %405 : Float(1, 144, 160, 160) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%404, %extractor.features.4.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %406 : Float(1, 144, 160, 160) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%405, %extractor.features.4.conv.0.1.weight, %extractor.features.4.conv.0.1.bias, %extractor.features.4.conv.0.1.running_mean, %extractor.features.4.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %407 : Tensor = onnx::Constant[value={0}]()
  %408 : Tensor = onnx::Constant[value={6}]()
  %409 : Float(1, 144, 160, 160) = onnx::Clip(%406, %407, %408) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %410 : Float(1, 144, 80, 80) = onnx::Conv[dilations=[1, 1], group=144, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2]](%409, %extractor.features.4.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %411 : Float(1, 144, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%410, %extractor.features.4.conv.1.1.weight, %extractor.features.4.conv.1.1.bias, %extractor.features.4.conv.1.1.running_mean, %extractor.features.4.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %412 : Tensor = onnx::Constant[value={0}]()
  %413 : Tensor = onnx::Constant[value={6}]()
  %414 : Float(1, 144, 80, 80) = onnx::Clip(%411, %412, %413) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %415 : Float(1, 32, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%414, %extractor.features.4.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %416 : Float(1, 32, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%415, %extractor.features.4.conv.3.weight, %extractor.features.4.conv.3.bias, %extractor.features.4.conv.3.running_mean, %extractor.features.4.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %417 : Float(1, 192, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%416, %extractor.features.5.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %418 : Float(1, 192, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%417, %extractor.features.5.conv.0.1.weight, %extractor.features.5.conv.0.1.bias, %extractor.features.5.conv.0.1.running_mean, %extractor.features.5.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %419 : Tensor = onnx::Constant[value={0}]()
  %420 : Tensor = onnx::Constant[value={6}]()
  %421 : Float(1, 192, 80, 80) = onnx::Clip(%418, %419, %420) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %422 : Float(1, 192, 80, 80) = onnx::Conv[dilations=[1, 1], group=192, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%421, %extractor.features.5.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %423 : Float(1, 192, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%422, %extractor.features.5.conv.1.1.weight, %extractor.features.5.conv.1.1.bias, %extractor.features.5.conv.1.1.running_mean, %extractor.features.5.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %424 : Tensor = onnx::Constant[value={0}]()
  %425 : Tensor = onnx::Constant[value={6}]()
  %426 : Float(1, 192, 80, 80) = onnx::Clip(%423, %424, %425) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %427 : Float(1, 32, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%426, %extractor.features.5.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %428 : Float(1, 32, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%427, %extractor.features.5.conv.3.weight, %extractor.features.5.conv.3.bias, %extractor.features.5.conv.3.running_mean, %extractor.features.5.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %429 : Float(1, 32, 80, 80) = onnx::Add(%416, %428) # /home/dai/py37env/lib/python3.7/site-packages/torchvision/models/mobilenet.py:67:0
  %430 : Float(1, 192, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%429, %extractor.features.6.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %431 : Float(1, 192, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%430, %extractor.features.6.conv.0.1.weight, %extractor.features.6.conv.0.1.bias, %extractor.features.6.conv.0.1.running_mean, %extractor.features.6.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %432 : Tensor = onnx::Constant[value={0}]()
  %433 : Tensor = onnx::Constant[value={6}]()
  %434 : Float(1, 192, 80, 80) = onnx::Clip(%431, %432, %433) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %435 : Float(1, 192, 80, 80) = onnx::Conv[dilations=[1, 1], group=192, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%434, %extractor.features.6.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %436 : Float(1, 192, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%435, %extractor.features.6.conv.1.1.weight, %extractor.features.6.conv.1.1.bias, %extractor.features.6.conv.1.1.running_mean, %extractor.features.6.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %437 : Tensor = onnx::Constant[value={0}]()
  %438 : Tensor = onnx::Constant[value={6}]()
  %439 : Float(1, 192, 80, 80) = onnx::Clip(%436, %437, %438) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %440 : Float(1, 32, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%439, %extractor.features.6.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %441 : Float(1, 32, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%440, %extractor.features.6.conv.3.weight, %extractor.features.6.conv.3.bias, %extractor.features.6.conv.3.running_mean, %extractor.features.6.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %442 : Float(1, 32, 80, 80) = onnx::Add(%429, %441) # /home/dai/py37env/lib/python3.7/site-packages/torchvision/models/mobilenet.py:67:0
  %443 : Float(1, 192, 80, 80) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%442, %extractor.features.7.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %444 : Float(1, 192, 80, 80) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%443, %extractor.features.7.conv.0.1.weight, %extractor.features.7.conv.0.1.bias, %extractor.features.7.conv.0.1.running_mean, %extractor.features.7.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %445 : Tensor = onnx::Constant[value={0}]()
  %446 : Tensor = onnx::Constant[value={6}]()
  %447 : Float(1, 192, 80, 80) = onnx::Clip(%444, %445, %446) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %448 : Float(1, 192, 40, 40) = onnx::Conv[dilations=[1, 1], group=192, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2]](%447, %extractor.features.7.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %449 : Float(1, 192, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%448, %extractor.features.7.conv.1.1.weight, %extractor.features.7.conv.1.1.bias, %extractor.features.7.conv.1.1.running_mean, %extractor.features.7.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %450 : Tensor = onnx::Constant[value={0}]()
  %451 : Tensor = onnx::Constant[value={6}]()
  %452 : Float(1, 192, 40, 40) = onnx::Clip(%449, %450, %451) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %453 : Float(1, 64, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%452, %extractor.features.7.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %454 : Float(1, 64, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%453, %extractor.features.7.conv.3.weight, %extractor.features.7.conv.3.bias, %extractor.features.7.conv.3.running_mean, %extractor.features.7.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %455 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%454, %extractor.features.8.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %456 : Float(1, 384, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%455, %extractor.features.8.conv.0.1.weight, %extractor.features.8.conv.0.1.bias, %extractor.features.8.conv.0.1.running_mean, %extractor.features.8.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %457 : Tensor = onnx::Constant[value={0}]()
  %458 : Tensor = onnx::Constant[value={6}]()
  %459 : Float(1, 384, 40, 40) = onnx::Clip(%456, %457, %458) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %460 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=384, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%459, %extractor.features.8.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %461 : Float(1, 384, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%460, %extractor.features.8.conv.1.1.weight, %extractor.features.8.conv.1.1.bias, %extractor.features.8.conv.1.1.running_mean, %extractor.features.8.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %462 : Tensor = onnx::Constant[value={0}]()
  %463 : Tensor = onnx::Constant[value={6}]()
  %464 : Float(1, 384, 40, 40) = onnx::Clip(%461, %462, %463) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %465 : Float(1, 64, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%464, %extractor.features.8.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %466 : Float(1, 64, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%465, %extractor.features.8.conv.3.weight, %extractor.features.8.conv.3.bias, %extractor.features.8.conv.3.running_mean, %extractor.features.8.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %467 : Float(1, 64, 40, 40) = onnx::Add(%454, %466) # /home/dai/py37env/lib/python3.7/site-packages/torchvision/models/mobilenet.py:67:0
  %468 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%467, %extractor.features.9.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %469 : Float(1, 384, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%468, %extractor.features.9.conv.0.1.weight, %extractor.features.9.conv.0.1.bias, %extractor.features.9.conv.0.1.running_mean, %extractor.features.9.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %470 : Tensor = onnx::Constant[value={0}]()
  %471 : Tensor = onnx::Constant[value={6}]()
  %472 : Float(1, 384, 40, 40) = onnx::Clip(%469, %470, %471) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %473 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=384, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%472, %extractor.features.9.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %474 : Float(1, 384, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%473, %extractor.features.9.conv.1.1.weight, %extractor.features.9.conv.1.1.bias, %extractor.features.9.conv.1.1.running_mean, %extractor.features.9.conv.1.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %475 : Tensor = onnx::Constant[value={0}]()
  %476 : Tensor = onnx::Constant[value={6}]()
  %477 : Float(1, 384, 40, 40) = onnx::Clip(%474, %475, %476) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %478 : Float(1, 64, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%477, %extractor.features.9.conv.2.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %479 : Float(1, 64, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%478, %extractor.features.9.conv.3.weight, %extractor.features.9.conv.3.bias, %extractor.features.9.conv.3.running_mean, %extractor.features.9.conv.3.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %480 : Float(1, 64, 40, 40) = onnx::Add(%467, %479) # /home/dai/py37env/lib/python3.7/site-packages/torchvision/models/mobilenet.py:67:0
  %481 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[1, 1]](%480, %extractor.features.10.conv.0.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
  %482 : Float(1, 384, 40, 40) = onnx::BatchNormalization[epsilon=1e-05, momentum=0.9](%481, %extractor.features.10.conv.0.1.weight, %extractor.features.10.conv.0.1.bias, %extractor.features.10.conv.0.1.running_mean, %extractor.features.10.conv.0.1.running_var) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:1670:0
  %483 : Tensor = onnx::Constant[value={0}]()
  %484 : Tensor = onnx::Constant[value={6}]()
  %485 : Float(1, 384, 40, 40) = onnx::Clip(%482, %483, %484) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/functional.py:958:0
  %486 : Float(1, 384, 40, 40) = onnx::Conv[dilations=[1, 1], group=384, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1]](%485, %extractor.features.10.conv.1.0.weight) # /home/dai/py37env/lib/python3.7/site-packages/torch/nn/modules/conv.py:342:0
      ...
      ...
      ... 

@Arctanxy have you solved the problem? I met exact same problem with the latest 0.7dev1 version

Also experiencing this problem in release v0.6.1, hopefully I can provide more details.

You can find the ONNX model I am importing here. It takes input of shape [1, 3, 224, 224], and the input name is input_2.

By printing the clip information from clip() in tensor.py, I get the following:

v0.0.4
free_var %clip_min26: float32
%clip_min26 v0.0.4
free_var %clip_max26: float32
%clip_max26 

This suggests that both values are of type float, rather than ObjectCell in the error.

I am creating the ONNX model with the keras2onnx tool, so it’s possible it is generating some malformed ONNX. However it does work when running in the onnxruntime.

I would like to reraise this issue. I download and attempt to compile a GoogleNet v12 model from this repository (well-used and starred).

Once downloaded, and upon compilation phase, I receive the exact same error. The model source is Caffe BVLC GoogLeNet ==> Caffe2 GoogLeNet ==> ONNX GoogLeNet. I do not receive problems with older models (like GoogleNet-9). I also use the latest version of TVM (v0.8.0). Are there any insights on this? Thank you in advance.

1 Like