TRT4 TO TRT5

Hi, i implemented a custom layer in TRT4 before, using the IPlugin and PluginFactory interface. But i found TRT5 uses the IPluginV2 and IpluginCreator interface to add custom layers. I wonder if the old APIs in TRT4 could be applicable in TRT5? Thanks.

We are using some custom layers which are implemented by old APIs(TRT4.0.1.6) in TRT5.0.2.6, and they all work well.
We test them in caffe, onnx and tensorflow models.

Hi, I found when i use TRT4 to implement a custom layer, the layernames of two createPlugin functions are same, but in TRT5, i printed the layernames of two createPlugin functions, but they are different:
“_SpaceToDepth” and “_SpaceToDepth_space_to_depth_2/SpaceToDepth”. So i want to know what the naming rule is.

virtual nvinfer1::IPlugin* createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights, const nvuffparser::FieldCollection fc) override
{
assert(isPlugin(layerName));
if (!strcmp(layerName, “_SpaceToDepth”)){
assert(lrelu21_reshape.get() == nullptr);
assert(nbWeights == 0 && weights == nullptr);
lrelu21_reshape = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>(createYOLOReorgPlugin(2), nvPluginDeleter);
return lrelu21_reshape.get();
}
else{
std::cout << layerName << std::endl;
assert(0);
return nullptr;
}
}

IPlugin* <b>createPlugin(const char* layerName, const void* serialData, size_t serialLength) override //for serialized model</b>
{
        assert(isPlugin(layerName));
        if (<b>!strcmp(layerName, "_SpaceToDepth_space_to_depth_2/SpaceToDepth")</b>)
        {
                 assert(lrelu21_reshape == nullptr);
                 lrelu21_reshape = std::unique_ptr<INvPlugin, decltype(nvPluginDeleter)>(createYOLOReorgPlugin(serialData, serialLength), nvPluginDeleter);
                 return lrelu21_reshape.get();
        }
        else
        {
                 assert(0);
                 return nullptr;
        }
}