-
Notifications
You must be signed in to change notification settings - Fork 7
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
Optimized Tensors #167
Optimized Tensors #167
Conversation
@zivmo99 |
@dolby360 |
13cdc4d
to
3237bc7
Compare
547277c
to
d897ca1
Compare
@halfway258 please approve that this PR works fine. |
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.
@halfway258
This is the generic file that contains useful methods.
src_erl/erlBridge/nerlTests.erl
Outdated
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.
@halfway258 nerlTests .erl implementation
|
||
COMPILE_FILES="$COMPILE_NERL,$COMPILE_NERLNIF,$COMPILE_NERLTEST" | ||
|
||
erl -noshell -eval "$COMPILE_FILES, nerlTests:run_tests()." -s init stop > "$NERLNET_TEST_DIR/$LOG_FILE" |
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.
@dolby360
Here is the calling to nerlTests module
If you want to get some kind of exception to see if action fails you just can change it as follows:
"$COMPILE_FILES, throw(check), nerlTests:run_tests()."
a2f74e6
to
894384f
Compare
} | ||
|
||
|
||
template<typename BasicType> void get_tensor_data(ErlNifEnv *env , ERL_NIF_TERM bin_term, std::vector<BasicType> &data, std::vector<BasicType> &dims_orig, std::vector<int> &dims) |
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.
Should change to
get_tensor(ErlNifEnv *env , ERL_NIF_TERM bin_term, TensorTypePtr &tensor_ptr)
Rowmajor binary map to rowmajor tensor swap to colmajor tensor
make_tensor(ErlNifEnv *env , nifpp::TERM &out_bin_term, TensorTypePtr &tensor_ptr)
convert colmajor --> rowmajor --> binary
end. | ||
|
||
|
||
tic() -> erlang:timestamp(). |
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.
erlang has a function that does this: {TimeTook, ReturnVal} = timer:tc(M, F, A)
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.
Good point
I ran the tests, all good |
Please run it again with my latest push (on raspberry pi as well) just to make sure and approve this PR |
- TODO implement the encode_nif function Helpful link: https://stackoverflow.com/questions/9521854/creating-a-erlang-binary-through-nif-with-data-pointing-to-a-char
Remained tasks: - decode_eigen_tensor - check nif
Encode works Decode WIP
TODO - Create test for conversion - Complete cpp implementation of decode_bin_to_eigen_tensor method
@zivmo99
Hi Ziv,
Please implement encode_nif
Please review my implementation in both erl files and cpp especially
decode_nif, get_binary methods.
Thanks
Note: This should be merged only after the PR of onn600!