mxnet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] wkcn edited a comment on issue #14030: The bug in MXTVMBridge
Date Fri, 01 Feb 2019 00:03:36 GMT
wkcn edited a comment on issue #14030: The bug in MXTVMBridge
   Is it possible to provide an API like this?
   Call `_RemoteCallPacked` to avoid the problem of ABI compatibility.
   class PackedFunc {
     using FType = std::function<void(TVMArgs args, TVMRetValue* rv)>;
     PackedFunc() {
     explicit PackedFunc(FType body) : body_(body) {
     void CallPacked(TVMArgs args, TVMRetValue* rv) const {
       _RemoteCallPacked(this, args, rv);
     template <typename... Args>
     inline TVMRetValue operator()(Args&&... args) const {
       const int kNumArgs = sizeof...(Args);
       const int kArraySize = kNumArgs > 0 ? kNumArgs : 1;
       TVMValue values[kArraySize];
       int type_codes[kArraySize];
       detail::for_each(TVMArgsSetter(values, type_codes),
       TVMRetValue rv;
       _RemoteCallPacked(this, TVMArgs(values, type_codes, kNumArgs), &rv);
       return rv;
     inline void _CallPacked(TVMArgs args, TVMRetValue* rv) const {
       body_(args, rv);
     void SetRemoteCallPacked() {
       _RemoteCallPacked = [](const PackedFunc* func, TVMArgs args, TVMRetValue* rv) {
         func->_CallPacked(args, rv);
     void (*_RemoteCallPacked)(const PackedFunc* func, TVMArgs args, TVMRetValue* rv);
     FType body_;

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message