-
Notifications
You must be signed in to change notification settings - Fork 751
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
Full example for MxNet #332
Comments
Sure, contributions are welcome! If you try to port that code, but are having issues, please let me know, thanks! |
I tried some simple code, but had jvm crashed: SymbolHandle sym_h = new SymbolHandle();
MXSymbolCreateVariable("X", new PointerPointer(sym_h));
MXSymbolFree(sym_h); Is there any problem in the code? The error log:
|
I don't know, could you also provide the code in C that you are trying to port? |
BTW, if you have a working build for Windows, please consider making a contribution and send a pull request for that! Alternatively, you could collaborate with @Neiko2002 and his pull request #309. Thanks |
The cpp code is from https://github.com/dmlc/MXNet.cpp/blob/master/example/mlp.cpp auto sym_x = Symbol::Variable("X");
The definition of Symbol in "mxnet-cpp/symbol.hpp":
/*! \brief handle to a symbol that can be bind as operator */
typedef void *SymbolHandle;
......
Symbol::Symbol(SymbolHandle handle) {
blob_ptr_ = std::make_shared<SymBlob>(handle);
}
Symbol::Symbol(const char *name) {
SymbolHandle handle;
CHECK_EQ(MXSymbolCreateVariable(name, &(handle)), 0);
blob_ptr_ = std::make_shared<SymBlob>(handle);
}
Symbol::Symbol(const std::string &name) : Symbol(name.c_str()) {}
Symbol Symbol::Variable(const std::string &name) { return Symbol(name); } The MXSymbolCreateVariable is in mxnet C API. |
It looks like what you want to do is this then: SymbolHandle sym_h = new SymbolHandle();
MXSymbolCreateVariable("X", sym_h);
MXSymbolFree(sym_h); |
Hum, it looks like that declaration is missing. |
Yes, that's what I really want, I'll test it when it fixed. |
* Add functions missing from the presets of MXNet (issue #332)
Ok, I've fixed the issue in the commit above. Let me know if you encounter any other issues and thanks for looking into this! |
Thanks! I'll try it. |
Could you please check these code: SymbolHandle sym = new SymbolHandle(); I got jvm crashed. Again, is there any problem in the code? |
Did you try with new PointerPointer(num) and num > 0?
|
My mistake, I should use a real Symbol. I'll keep going with other functions. |
@yunge Have you made any progress? Is it working well now with MXNet 1.0.0? Or are there remaining issues? |
@saudet Hi, I don't use javacpp now. |
@yunge What are you using these days? |
@saudet I use python api directly. |
Current MxNet example is just show how to do prediction, please add some example code for creating model & training, thanks.
MxNet has full featured cpp examples, such as
https://github.com/dmlc/MXNet.cpp/blob/master/example/mlp.cpp
The text was updated successfully, but these errors were encountered: