如何解决onnx-tensorrt解析器中的解析插件
我有一个带有两个输入的CDCGreedyDecoder插件,所附图片中显示了最后一层(最后一层)。 因此该层有两个输入和一个输出。
Onnx-TensorRT解析器用于将插件解析为文件 TensorRT / parsers / onnx / builtin_op_importers.cpp中的TensorRT。如下.strong text
DEFINE_BUILTIN_OP_IMPORTER(CTCGreedyDecoder)
{
//const int nbInputs = node.input().size();
//const int nbOutputs = node.output().size();
//LOG_ERROR("nbInputs: " << nbInputs );
//LOG_ERROR("nbOutputs: " << nbOutputs );
//ASSERT(inputs.at(1).is_weights(),ErrorCode::kUNSUPPORTED_NODE);
//ASSERT(inputs.at(2).is_weights(),ErrorCode::kUNSUPPORTED_NODE);
nvinfer1::ITensor* tensorPtr = &convertToTensor(inputs.at(0),ctx);
int nbDims = tensorPtr->getDimensions().nbDims;
ASSERT(nbDims >= 3 && nbDims <= 4 && "TensorRT only supports InstanceNormalization on 3D or 4D tensors!",ErrorCode::kUNSUPPORTED_NODE);
OnnxAttrs attrs(node,ctx);
// Populate instanceNormalization plugin properties.
const std::string pluginName = "CTCGreedyDecoder_TRT";
const std::string pluginVersion = "1";
std::vector<nvinfer1::PluginField> f;
// Create plugin from registry
nvinfer1::IPluginV2* plugin = importPluginFromRegistry(ctx,pluginName,pluginVersion,node.name(),f);
ASSERT(plugin != nullptr && "CTCGreedyDecoder plugin was not found in the plugin registry!",ErrorCode::kUNSUPPORTED_NODE);
auto* layer = ctx->network()->addPluginV2(&tensorPtr,1,*plugin);
ctx->registerLayer(layer,node.name());
RETURN_FIRST_OUTPUT(layer);
}
在CDCGreedyDecoder中打印输出和输出的数量以及在输入/输出中找到的数量如下。
[TRT]: /home/xavier/TensorRT/parsers/onnx/builtin_op_importers.cpp:1567: nbInputs:2
[TRT]: /home/xavier/TensorRT/parsers/onnx/builtin_op_importers.cpp:1568: nbOutputs: 1
将onnx模型转换为引擎时,在CDCGreedyDecoder plugin’s
方法中观察到输入1的数量
void configurePlugin(const DynamicPluginTensorDesc* in,int nbInput,const DynamicPluginTensorDesc* out,int nbOutput) override.
应该是2。
我的onnx-tensorrt解析器实现的实现有什么问题?
上方显示了DEFINE_BUILTIN_OP_IMPORTER(CTCGreedyDecoder) parser
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。