New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue error when serializing ANN models without MLPACK_ENABLE_ANN_SERIALIZATION
#3451
Issue error when serializing ANN models without MLPACK_ENABLE_ANN_SERIALIZATION
#3451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is causing some issues with the test cases.
I think it actually has to do with cotire and precompiled headers. When compiling simple test programs by hand with and without |
Ok, got it figured out now. The fix was relatively straightforward and had to do with cotire, like I thought. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
This is a fix for @yurivict's suggestion in #3449.
If
MLPACK_ENABLE_ANN_SERIALIZATION
is not defined, then we issue a runtime exception. I tried to make it a static assertion only, so the failure was at compile time, but I couldn't quickly find a way to make the compilation fail only whenFFN::serialize()
was called (orRNN::serialize()
). I think the runtime error is fine though.I left an "escape mechanism": if the user defines
MLPACK_ANN_IGNORE_SERIALIZATION_WARNING
, then the exception is not thrown. This is in case a user wants to specifically instantiate serialization for only certain layers, which would be done with customCEREAL_REGISTER_TYPE()
calls.