Old pytorch 0.4 cuda implementation to pytorch 1.0 questions

I encounter a same problem like Converting Old (pre-PyTorch1.0) C++/CUDA 8 extensions to PyTorch 1.0 C++/CUDA 9 extension.

The project I want to convert is here: https://github.com/speedinghzl/CCNet

I follow the official guide and write PYBIND11_MODULE in src/lib_cffi.cpp file and a setup.py to compile the whole source files. But it fails and mainly shows the errors below:

/home/users/USERNAME/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/detail/descr.h:38:42: error: invalid use of incomplete type ‘struct CUstream_st’
         return {{&typeid(Ts)..., nullptr}};
                                          ^

/home/users/USERNAME/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pybind11.h:168:73: error: ‘static constexpr std::array<const std::type_info*, (sizeof... (Ts) + 1)> pybind11::detail::descr<N, Ts>::types() [with long
 unsigned int N = 67ul; Ts = {CUstream_st}]’ called in a constant expression
         PYBIND11_DESCR_CONSTEXPR auto types = decltype(signature)::types();

Could any one give me a help? I am very confused about this error and have no idea to solve it.

I have solved it successfully. Thanks.

This is a bit late, but I’m running into a similar problem. Do you remember how you solved this ? Thanks.
EDIT: mentioning @Theodorus_Zhou explicitly so you might get a notification…

Just for reference here: it seems like one cannot expose cuda types directly using pybind. So they have to wrapped by other cpp classes/structs to be able to expose them to python through pybind.