You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/02 09:00:35 UTC
[GitHub] [incubator-tvm] nolanliou commented on issue #6268: TVMError: Check failed: it != type_definitions.end(): There is no definition of static_tensor_float32_*
nolanliou commented on issue #6268:
URL: https://github.com/apache/incubator-tvm/issues/6268#issuecomment-685459847
Sample code to reproduce the problem of inputs' type not matching.
```
import numpy as np
import torch
import tvm
from tvm import relay
import tvm.contrib.graph_runtime as runtime
def fn(x):
y = (x - 1).long()
y = y.to(dtype=torch.float32)
y = y[:, 0]
return y
jit = torch.jit.trace(fn, (torch.ones(4, 5, dtype=torch.int64),))
torch.jit.save(jit, "test.jit")
jit = torch.jit.load("test.jit", map_location=torch.device('cpu'))
jit.eval()
inputs = torch.randint(low=0, high=10, size=(4, 5), dtype=torch.int64)
print(jit(inputs))
shape_list = [('input', [4, 5])]
mod, params = relay.frontend.pytorch.from_pytorch(jit,
shape_list,
default_dtype="float32")
with tvm.transform.PassContext(opt_level=3):
json, lib, params = relay.build(mod, target="llvm", params=params)
ctx = tvm.cpu(0)
inputs = tvm.nd.array(inputs.cpu().numpy().astype(np.int64), ctx)
runtime = tvm.contrib.graph_runtime.create(json, lib, ctx)
runtime.set_input(**params)
runtime.set_input('input', inputs)
runtime.run()
tvm_result = runtime.get_output(0).asnumpy()
print(tvm_result)
```
There is no type of information in the JIT file, seems TVM cannot support the situation (load from JIT file) yet.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org