musram opened a new issue, #16636:
URL: https://github.com/apache/tvm/issues/16636

   
https://github.com/apache/tvm/blob/89cc09c62103d74dce02e03754261b1e205cadab/include/tvm/runtime/c_runtime_api.h#L208
   actually defines the TVMValue as union
   /*!
    * \brief Union type of values
    *  being passed through API and function calls.
    */
   typedef union {
     int64_t v_int64;
     double v_float64;
     void* v_handle;
     const char* v_str;
     DLDataType v_type;
     DLDevice v_device;
   } TVMValue;
   
   we create ndarray like:
         tvm::runtime::NDArray input_features_ndarray =
             Create3DNDArrayFrom1DArray(input_features, 1, 80, 3000);
   
         TVMValue tvm_args;
         int tvm_arg_types;
   
          tvm_args.v_handle = static_cast<void*>(&input_features_ndarray);
   
        in the Packed function:
           return PackedFunc([this, sptr_to_self](TVMArgs args, TVMRetValue* 
rv) {
               ICHECK(args.size() == 4);
               TVMValue* tvm_args = static_cast<TVMValue*>(args[0].operator 
void*());
               int* tvm_arg_types = static_cast<int*>(args[1].operator void*());
    
               the above line of code works/
   
               But if i replace 
                NDArray ndarray = static_cast<NDArray>(args[0].operator 
NDArray());
               I get an error:
              tvm/runtime/packed_func.h:600: InternalError: Check failed: 
type_code_ == kTVMNDArrayHandle (3 vs. 13) : expected 
             NDArrayContainer but got handle
             This is coming from 
https://github.com/apache/tvm/blob/89cc09c62103d74dce02e03754261b1e205cadab/include/tvm/runtime/packed_func.h#L598
          Now if we want to pass a ndarray how to pass it to the PackedFunc?
   
          Similar way  in java if i create
          NDArray ndarray = NDArray.empty(new long[]{2, 2}, new 
TVMType("float64"));
         
          and pass to PackedFunc, i get 3 vs. 13) : expected 
             NDArrayContainer but got handle.
         
   
         
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to