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
Serialization of ann #513
Comments
If you do this, we can't create a default optimizer in the way we do it right now, Because in C++ 'this' (keyword) is not an lvalue, so it isn't possible to create a pointer to this. Correct me if I'm on the wrong track. |
According to the answer of stackoverflow, it should be safe to that as long as we do not access the member haven't construct yet(including virtual member function, but mlpack do not use any virtual, so I think this would not be an issue). What I mean is, change the reference to pointer as following
So we could construct it as
Is this the problem you are worrying about?Or we are talking different problems? ps : I forgot I open the same issue on #495, rcurtin has an example. If you think it is ok, I would find a way to serialize it. |
I see that would solve the issue, you are right. If you make the changes, can you also modify the other ann optimizer classes? I guess it would be a good idea, to close one of the pull requests and make a reference to the other pull request, what do you think? |
One of the keys of the refactoring I did for serialization is that I attempted to keep the interfaces using references, and not pointers, for the sake of simplicity. i.e.
I guess this would make the call to |
No problem
Nice suggestion, but I think what you mean is
Thanks for closing replicated issue |
Yeah, exactly, I am just not very good at typing :) |
Some problems need to be solved. Optimizer of ann will take the address of DecomposableFunctionType, the solution I come up is
optimizer part
What do you think about it?Thanks |
Looks good to me. I would change the |
Looks good to me |
One more problem, CreateNVP cannot serialize arma::Cube, mlpack do not implement this feature yet or I do not use it properly? Thanks ps : armadillo 6.5 provide conv2 for 2D convolution, maybe this can simplify and speed up the convolution layer? Besides, serialization of optimizer and most of the layers are done(except of conv_layer, lstm_layer and pooling_layer, because they need to serialize arma::cube) |
I haven't implemented serialization of cubes yet. Take a look at If you don't have time, I can get around to it eventually, but as always, my todo list is quite long... :) |
I will implement serialization of cubes and write the test cases, looks like it would take a while before FFN can be serialize(at first I though it should be quite fast) |
I have some questions about the file Mat_extra_meat.hpp, the function
Looks like a member function of the Mat of armadillo, how could you add it into the declaration of armadillo?Thanks |
Ooh, this is a really cool trick that Conrad wrote into Armadillo and I really like it. Inside of Mat_bones.hpp there are these lines, inside of the definition of the class
So if you've defined |
Serialization is not complete AFAIK: The following test fails (100% error):
Note that |
I guess, the problem can be solved by using something like this:
I can't test this right now. |
In c75652b I made the necessary changes, let me know if that fixes your error. |
Thanks. I "smoke" tested CNN serialization and it works. On Thu, Mar 10, 2016 at 3:56 AM, Marcus Edel notifications@github.com
Joseph Chakravarti Mariadassou |
I would like to make the ann support serialization(atleast for the ffn related parts).The optimizers of ann use reference to keep the address of the object, could I change them to pointer or shared_pointer?
The text was updated successfully, but these errors were encountered: