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/02/22 20:11:52 UTC

[GitHub] [tvm] mbs-octoml commented on a change in pull request #10293: [VirtualMachine] new method allowing to set one input tensor by its index or name

mbs-octoml commented on a change in pull request #10293:
URL: https://github.com/apache/tvm/pull/10293#discussion_r812314673



##########
File path: include/tvm/runtime/vm/vm.h
##########
@@ -93,7 +93,10 @@ struct VMFunction {
         params(std::move(params)),
         instructions(std::move(instructions)),
         register_file_size(register_file_size),
-        param_device_indexes(std::move(param_device_indexes)) {}
+        param_device_indexes(std::move(param_device_indexes)) {
+    ICHECK_EQ(params.size(), param_device_indexes.size())
+        << "The number of provided parameters doesn't match the number of assigned devices";

Review comment:
       nit: message does not make sense

##########
File path: src/runtime/vm/vm.cc
##########
@@ -221,6 +211,9 @@ PackedFunc VirtualMachine::GetFunction(const std::string& name,
   } else if (name == "set_input") {
     return PackedFunc(
         [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { SetInput(args[0], args, 1); });
+  } else if (name == "set_one_input") {

Review comment:
       nit: suggest a unit test  exercising this new method from vm.py (though I'm assuming you need to change that anyway, perhaps in a follow up PR?) Maybe you are just using the runtime module directly?

##########
File path: include/tvm/runtime/vm/vm.h
##########
@@ -270,6 +273,15 @@ class VirtualMachine : public runtime::ModuleNode {
    */
   void SetInput(std::string name, TVMArgs args, int offset);
 
+  /*!
+   * \brief Set one input tensor with index or name to a function.
+   * \param name The function name
+   * \param args args[1:] are two arguments (index or name, tensor) to the

Review comment:
       nit: might as well just pass two args since fixed size
   nit: Would call it just SetOneInput to match above.

##########
File path: include/tvm/runtime/vm/vm.h
##########
@@ -286,6 +298,48 @@ class VirtualMachine : public runtime::ModuleNode {
    */
   virtual void OpStopHook();
 
+ private:
+  /*!
+   * \brief Get index of input tensor from its name.
+   * \param func_name The function's name.
+   * \param input_name The input tensor name.
+   * \return The input tensor index.
+   */
+  int64_t getInputIndexFromVMFunction(const std::string& func_name,

Review comment:
       nit: capitalize (and below)




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