Suppress boost registration warnings in pycaffe#3960
Suppress boost registration warnings in pycaffe#3960TanLingxiao wants to merge 1 commit intoBVLC:masterfrom TanLingxiao:patch-2
Conversation
I change four palces like 'const boost::python::type_info ainfo = boost::python::type_id<shared_ptr<Net<Dtype> > >();
const boost::python::converter::registration* areg = boost::python::converter::registry::query(ainfo);
if (areg == NULL)
{
bp::register_ptr_to_python<shared_ptr<Net<Dtype> > >();
}
else if ((*areg).m_to_python == NULL) {
bp::register_ptr_to_python<shared_ptr<Net<Dtype> > >();
} '
It can avoided some problems when use 'make pycaffe' command.
|
@TanLingxiao Make sure to lint, and please compare to the related #3866. At first glance this looks like it will be compatible across boost versions, but it's too bad this (apparently) has to be so verbose. |
|
If this is the same pattern used in 4 places, maybe this can be made into a macro? |
|
Something like this? /* Fix to avoid registration warnings in pycaffe (#3960) */
#define BP_REGISTER_SHARED_PTR_TO_PYTHON(PTR) do { \
const boost::python::type_info info = \
boost::python::type_id<shared_ptr<PTR > >(); \
const boost::python::converter::registration* reg = \
boost::python::converter::registry::query(info); \
if (reg == NULL) { \
bp::register_ptr_to_python<shared_ptr<PTR > >(); \
} else if ((*reg).m_to_python == NULL) { \
bp::register_ptr_to_python<shared_ptr<PTR > >(); \
} \
} while (0)
...
BP_REGISTER_SHARED_PTR_TO_PYTHON(Net<Dtype>);
...
BP_REGISTER_SHARED_PTR_TO_PYTHON(Blob<Dtype>);
...
BP_REGISTER_SHARED_PTR_TO_PYTHON(Layer<Dtype>);
...
BP_REGISTER_SHARED_PTR_TO_PYTHON(Solver<Dtype>);
...Note: the Also, please run |
|
Ping? It would be great to get this warning fixed; it adds unnecessary noise to log files and to tutorials for caffe (explaining that the warning can be ignored). |
|
@seanbell yeah, I'd be fine with a linted version of this patch turned into a macro. It would be good to resolve this, so we'll have to see if it can be dispatched sometime soon while having a coffee between NIPS experiments. |
|
I made a PR at #4069, containing the above fix turned into a macro. |
suppress boost registration warnings in pycaffe (based on #3960)
|
Closed by fix in #4069 based on this patch. Thanks @TanLingxiao for first suggesting this. |
|
I don't know why you received email from me |
|
It is interesting. @hongweipeng |
suppress boost registration warnings in pycaffe (based on BVLC#3960)
I change four palces like 'const boost::python::type_info ainfo = boost::python::type_id<shared_ptr<Net > >();
const boost::python::converter::registration* areg = boost::python::converter::registry::query(ainfo);
if (areg == NULL)
{
bp::register_ptr_to_python<shared_ptr<Net > >();
}
else if ((*areg).m_to_python == NULL) {
bp::register_ptr_to_python<shared_ptr<Net > >();
} '
It can avoided some problems when use 'make pycaffe' command.