Last active
June 24, 2020 10:04
-
-
Save chyanju/83558fa5c74bedca00b8 to your computer and use it in GitHub Desktop.
A Piece of Code from MXNet.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Utility macro to call MXNet API functions" | |
macro mxcall(fv, argtypes, args...) | |
f = eval(fv) | |
args = map(esc, args) | |
quote | |
_mxret = ccall( ($(Meta.quot(f)), $MXNET_LIB), | |
Cint, $argtypes, $(args...) ) | |
if _mxret != 0 | |
err_msg = mx_get_last_error() | |
throw(MXError(err_msg)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment