MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / createPlugin

Method createPlugin

plugin/regionPlugin/regionPlugin.cpp:506–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506IPluginV2Ext* RegionPluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept
507{
508 try
509 {
510 PluginField const* fields = fc->fields;
511 for (int32_t i = 0; i < fc->nbFields; ++i)
512 {
513 char const* attrName = fields[i].name;
514 if (!strcmp(attrName, "num"))
515 {
516 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
517 params.num = *(static_cast<int32_t const*>(fields[i].data));
518 }
519 if (!strcmp(attrName, "coords"))
520 {
521 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
522 params.coords = *(static_cast<int32_t const*>(fields[i].data));
523 }
524 if (!strcmp(attrName, "classes"))
525 {
526 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
527 params.classes = *(static_cast<int32_t const*>(fields[i].data));
528 }
529 if (!strcmp(attrName, "smTree"))
530 {
531 // TODO not sure if this will work
532 void* tmpData = const_cast<void*>(fields[i].data);
533 params.smTree = static_cast<nvinfer1::plugin::softmaxTree*>(tmpData);
534 }
535 }
536
537 Region* obj = new Region(params);
538 obj->setPluginNamespace(mNamespace.c_str());
539 return obj;
540 }
541 catch (std::exception const& e)
542 {
543 caughtError(e);
544 }
545 return nullptr;
546}
547
548IPluginV2Ext* RegionPluginCreator::deserializePlugin(
549 char const* name, void const* serialData, size_t serialLength) noexcept

Callers

nothing calls this directly

Calls 3

caughtErrorFunction · 0.85
c_strMethod · 0.80
setPluginNamespaceMethod · 0.45

Tested by

no test coverage detected