You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/04/15 18:12:35 UTC

[GitHub] [tvm] mbs-octoml commented on a diff in pull request #11003: [VirtualMachine] Zero copy in set_input when input is DLTensor

mbs-octoml commented on code in PR #11003:
URL: https://github.com/apache/tvm/pull/11003#discussion_r851416661


##########
src/runtime/vm/vm.cc:
##########
@@ -303,13 +303,12 @@ void VirtualMachine::SetInputTensorWithIndex(std::vector<ObjectRef>& tensors,
   if (inp_tensor.type_code() == kTVMDLTensorHandle) {
     // Automatically convert input DLTensors to NDArray
     DLTensor* tensor = inp_tensor;
-    std::vector<int64_t> shape;
-    for (int64_t i = 0; i < tensor->ndim; i++) {
-      shape.push_back(tensor->shape[i]);
+    if (dev.device_type == tensor->device.device_type &&

Review Comment:
   Thank you, this is a great change.
   
   Could you update vm.py's set_input doc string to clearly state the by-copy vs by-ref semantics? Thanks. 



-- 
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