create_plugin_node multiple arguments not accessible in C++

I try to pass additional arguments create plugin node

interp_resize_bilinear = gs.create_plugin_node(“interp_resize_bilinear”, op=“resize_bilinear”,shapecustom=[1,361,641,3],dtype=tf.float32)

however it is successfully written in uff.

as below
id: “main”
nodes {
id: “interp_resize_bilinear”
inputs: “Preprocessor/sub”
operation: “_resize_bilinear”
fields {
key: “dtype”
value {
dtype: DT_FLOAT32
}
}
fields {
key: “shapecustom_u_ilist”
value {
i_list {
val: 1
val: 361
val: 641
val: 3

}
}
}
}

But when i try to read the values in C++ TensorRT

IPluginV2* createPlugin(const char* name, const PluginFieldCollection* fc) override
{
	const PluginField* fields = fc->fields;
	std::cout << "Number of fields " << fc->nbFields << "for  " << name << fields[0].name << std::endl;

and i receive following printed :

Number of fields 1for interp_resize_bilinear dtype

any idea why shapecustom is not detected ???

Versions:


uff 0.5.5
graphsurgeon 0.3.2
TensorRT 5.0.4.3 - windows

I think you have not added the attributes in the constructor. Can you try this:

BilinearPluginCreator::BilinearPluginCreator()
{
    mPluginAttributes.emplace_back(PluginField("shapecustom", nullptr, PluginFieldType::kINT32, 4));

    mFC.nbFields = mPluginAttributes.size();
    mFC.fields = mPluginAttributes.data();
}
IPluginV2* BilinearPluginCreator::createPlugin(const char* name, const PluginFieldCollection* fc)
{
    const PluginField* fields = fc->fields;
    for (int i = 0; i < fc->nbFields; ++i)
    {
        const char* attrName = fields[i].name;
        (!strcmp(attrName, "shapecustom"))
        {
            assert(fields[i].type == PluginFieldType::kINT32);
            const float* data = static_cast<const float*>(fields[i].data);
            mShape = const_cast<float*>(data);

        }
    }

    return new BilinearPlugin();
}

Thanks eva211 :-) it works like gem