| 364 | } |
| 365 | |
| 366 | IPluginV2Ext* FlattenConcatPluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept |
| 367 | { |
| 368 | try |
| 369 | { |
| 370 | plugin::validateRequiredAttributesExist({"axis", "ignoreBatch"}, fc); |
| 371 | PluginField const* fields = fc->fields; |
| 372 | for (int32_t i = 0; i < fc->nbFields; ++i) |
| 373 | { |
| 374 | char const* attrName = fields[i].name; |
| 375 | if (!strcmp(attrName, "axis")) |
| 376 | { |
| 377 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 378 | mConcatAxisID = *(static_cast<int32_t const*>(fields[i].data)); |
| 379 | } |
| 380 | if (!strcmp(attrName, "ignoreBatch")) |
| 381 | { |
| 382 | PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32); |
| 383 | auto ignoreBatch = *(static_cast<int32_t const*>(fields[i].data)); |
| 384 | PLUGIN_VALIDATE(ignoreBatch == 0 || ignoreBatch == 1); |
| 385 | mIgnoreBatch = static_cast<bool>(ignoreBatch); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | auto* plugin = new FlattenConcat(mConcatAxisID, mIgnoreBatch); |
| 390 | plugin->setPluginNamespace(mNamespace.c_str()); |
| 391 | return plugin; |
| 392 | } |
| 393 | catch (std::exception const& e) |
| 394 | { |
| 395 | caughtError(e); |
| 396 | } |
| 397 | return nullptr; |
| 398 | } |
| 399 | |
| 400 | IPluginV2Ext* FlattenConcatPluginCreator::deserializePlugin( |
| 401 | char const* name, void const* serialData, size_t serialLength) noexcept |
nothing calls this directly
no test coverage detected