CUDA: 11.6 TensorRT: 8.5.1.7
import tvm
from tvm import relay
import onnx
import numpy as np
from tvm.relay.op.contrib.tensorrt import partition_for_tensorrt
from PIL import Image
img_path = “cat.png”
model_path = “super_resolution_0.2.onnx”
img = Image.open(img_path).resize((224, 224))
img_ycbcr = img.convert(“YCbCr”) # convert to YCbCr
img_y, img_cb, img_cr = img_ycbcr.split()
x = np.array(img_y)[np.newaxis, np.newaxis, :, :]
dtype = “float32”
onnx_model = onnx.load(model_path)
input_name = “1”
shape_dict = {input_name: x.shape}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict, dtype=dtype)
mod, config = partition_for_tensorrt(mod, params)
error: Check failed: type_code_ == kTVMObjectHandle (0 vs. 8) : expected Object but got int