You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "slyubomirsky (via GitHub)" <gi...@apache.org> on 2023/11/29 19:15:44 UTC

Re: [PR] [FFI] Introduce runtime boxed types for int/float/bool [tvm]

slyubomirsky commented on code in PR #16183:
URL: https://github.com/apache/tvm/pull/16183#discussion_r1409758961


##########
include/tvm/runtime/packed_func.h:
##########
@@ -547,29 +551,43 @@ class TVMPODValue_ {
     // Allow automatic conversion from int to float
     // This avoids errors when user pass in int from
     // the frontend while the API expects a float.
-    if (type_code_ == kDLInt) {
-      return static_cast<double>(value_.v_int64);
+    if (auto opt = TryAsBool()) {
+      return opt.value();
+    } else if (auto opt = TryAsInt()) {

Review Comment:
   Would any bool value also work as an int value? Maybe that's the reason for the ordering given.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org