Assertion failed: (inputs.at(1).is_weights()) && "This version of TensorRT only supports input K as an initializer

Description

I trained a Resnet152 using the Tensorflow Object Detection API. Then, I converted it to onnx and later, when trying to build an engine using trtexec, this error whoed up:
ERROR: /home/deep/TensorRT/parsers/onnx/builtin_op_importers.cpp:4292 In function importTopK:
[8] Assertion failed: (inputs.at(1).is_weights()) && “This version of TensorRT only supports input K as an initializer.”

Environment

TensorRT Version : 8.0.1.6
GPU Type : Nvidia RTX 2060
Nvidia Driver Version : 470.42.01
CUDA Version : 11.3
CUDNN Version : 8.2.1
Operating System + Version : Ubuntu 20.04 LTS
Python Version (if applicable) : 3.8.10
TensorFlow Version (if applicable) : 2.5
Cmake version: 3.13

Relevant Files

Here

Steps To Reproduce

trtexec --onnx=model_gs.onnx --saveEngine=resnet_engine.trt

Hi,
Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:
https://docs.nvidia.com/deeplearning/tensorrt/quick-start-guide/index.html#onnx-export

  1. validating your model with the below snippet

check_model.py

import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
onnx.checker.check_model(model).
2) Try running your model with trtexec command.

In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging
Thanks!

I´ve already done both. You can find the link to the onnx model above

Hi @emiliochambu,

Looks like we have similar issue here. Please refer

Thank you.