Нет типа с именем UpSamplePlugin
, это просто шаблон.Поэтому вы должны сделать что-то вроде UpSamplePlugin<T>
.В вашем случае это должно быть UpSamplePlugin<zoom_factor>
Попробуйте следующий код, , если это объявление находится внутри шаблона:
py::class_<UpSamplePlugin<zoom_factor>, nvinfer1::IPluginExt, std::unique_ptr<UpSamplePlugin, py::nodelete>>(m, "UpSamplePlugin")
// Bind the normal constructor as well as the one which deserializes the plugin
//.def(py::init<const nvinfer1::Weights*, int>())
.def(py::init<const void*, size_t>())
;
Компилятор «создаст» новый тип, соответствующий UpSamplePlugin<zoom_factor>
.
Если его нет в шаблоне:
Создать другой шаблон(это может быть функция шаблона), которая может быть вызвана с помощью zoom_factor для любого типа константы:
template<int zoom_factor>
void doSomething() {
py::class_<UpSamplePlugin<zoom_factor>, nvinfer1::IPluginExt, std::unique_ptr<UpSamplePlugin, py::nodelete>>(m, "UpSamplePlugin")
// Bind the normal constructor as well as the one which deserializes the plugin
//.def(py::init<const nvinfer1::Weights*, int>())
.def(py::init<const void*, size_t>())
;
}
Затем вы можете вызвать эту функцию с любым COMPILE TIME KNOWN zoom_factor