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

Method createPlugin

plugin/clipPlugin/clipPlugin.cpp:216–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216IPluginV2* ClipPluginCreator::createPlugin(char const* name, PluginFieldCollection const* fc) noexcept
217{
218 try
219 {
220 float clipMin = 0.0, clipMax = 0.0;
221 PluginField const* fields = fc->fields;
222
223 plugin::validateRequiredAttributesExist({"clipMin", "clipMax"}, fc);
224 PLUGIN_VALIDATE(fc->nbFields == 2);
225
226 for (int32_t i = 0; i < fc->nbFields; i++)
227 {
228 if (strcmp(fields[i].name, "clipMin") == 0)
229 {
230 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32);
231 clipMin = *(static_cast<float const*>(fields[i].data));
232 }
233 else if (strcmp(fields[i].name, "clipMax") == 0)
234 {
235 PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kFLOAT32);
236 clipMax = *(static_cast<float const*>(fields[i].data));
237 }
238 }
239
240 return new ClipPlugin(name, clipMin, clipMax);
241 }
242 catch (std::exception const& e)
243 {
244 caughtError(e);
245 }
246 return nullptr;
247}
248
249IPluginV2* ClipPluginCreator::deserializePlugin(char const* name, void const* serialData, size_t serialLength) noexcept
250{

Callers

nothing calls this directly

Calls 2

caughtErrorFunction · 0.85

Tested by

no test coverage detected