Skip to content

Instantly share code, notes, and snippets.

@chyanju
Last active June 24, 2020 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chyanju/83558fa5c74bedca00b8 to your computer and use it in GitHub Desktop.
Save chyanju/83558fa5c74bedca00b8 to your computer and use it in GitHub Desktop.
A Piece of Code from MXNet.jl
"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