samedi 6 octobre 2018

error: type/value mismatch at argument 1 in template parameter list for ‘template

Before we start, I am a complete noob in C++11, had used C several years ago.

I am trying to write a python binding of a C++11 code using pybind11 and is getting a subjected error. I am basically following this guide from Nvidia people and is stuck at this error. Can any nice soul point me to the right direction?

Definition:

template<int zoom_factor>
class UpSamplePlugin: public nvinfer1::IPluginExt
{
public:
    UpSamplePlugin() {}

    // Create the plugin at runtime from a byte stream.
    UpSamplePlugin(const void* buffer, size_t size)
    {
        assert(size == sizeof(mInputDims)); // assert datatype of input
        mInputDims = *reinterpret_cast<const nvinfer1::Dims*>(buffer);
    }
...
}

Call:

py::class_<UpSamplePlugin, 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>())
    ;

Error:

/media/.../plugin/pyUpSample.cpp: In function ‘void pybind11_init_upsampleplugin(pybind11::module&)’:
/media/.../plugin/pyUpSample.cpp:13:90: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Dp> class std::unique_ptr’
     py::class_<UpSamplePlugin, nvinfer1::IPluginExt, std::unique_ptr<UpSamplePlugin, py::nodelete>>(m, "UpSamplePlugin")
                                                                                          ^
/media/.../plugin/pyUpSample.cpp:13:90: note:   expected a type, got ‘UpSamplePlugin’

Aucun commentaire:

Enregistrer un commentaire