Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

TVM returns cryptic error message when the input tensor type is incorrect #2

Open
jxx123 opened this issue May 25, 2020 · 0 comments
Open
Assignees

Comments

@jxx123
Copy link
Collaborator

jxx123 commented May 25, 2020

Consider an input tensor like this
x = np.array(img).reshape(1, -1, 300, 300).astype(np.float32)

When the type casting is missing, e.g. x = np.array(img).reshape(1, -1, 300, 300), tvm returns interesting error msg like this (could be potential patch for tvm):

Traceback (most recent call last):

  File "src/onnx_to_relay.py", line 42, in <module>
    module.set_input(input_blob.name, tvm.nd.array(x))

  File "/home/jinyu/tvm/python/tvm/contrib/graph_runtime.py", line 158, in set_input
    self._get_input(key).copyfrom(value)

  File "/home/jinyu/tvm/python/tvm/runtime/ndarray.py", line 121, in copyfrom
    source_array.copyto(self)

  File "/home/jinyu/tvm/python/tvm/runtime/ndarray.py", line 186, in copyto
    return self._copyto(target)

  File "/home/jinyu/tvm/python/tvm/_ffi/_ctypes/ndarray.py", line 88, in _copyto
    check_call(_LIB.TVMArrayCopyFromTo(self.handle, target_nd.handle, None))

  File "/home/jinyu/tvm/python/tvm/_ffi/base.py", line 329, in check_call
    raise get_last_ffi_error()

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (1) /home/jinyu/tvm/build/libtvm.so(TVMArrayCopyFromTo+0xa) [0x7f35ef51d90a]
  [bt] (0) /home/jinyu/tvm/build/libtvm.so(tvm::runtime::NDArray::CopyFromTo(DLTensor const*, DLTensor*, void*)+0x7c0) [0x7f35ef51cf9
0]
  File "../src/runtime/ndarray.cc", line 222
TVMArrayCopyFromTo: Check failed: from_size == to_size (270000 vs. 1080000) : The size must exactly match
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant