icemelon9 commented on a change in pull request #7210:
URL: https://github.com/apache/tvm/pull/7210#discussion_r557753221



##########
File path: include/tvm/relay/op_attr_types.h
##########
@@ -85,7 +85,7 @@ using TNonComputational = bool;
 /*!
  * \brief Mark the operator whether output shape is data dependant.
  */
-using TShapeDataDependant = bool;
+using TShapeDataDependant = Array<Integer>;

Review comment:
       Maybe using `Bool` is better here?

##########
File path: src/relay/backend/compile_engine.cc
##########
@@ -518,16 +518,27 @@ class MakeShapeFunc : public 
backend::MemoizedExprTranslator<Array<te::Tensor>>
         << "Internal error, cannot find TShapeDataDependant for " << op->name;
 
     data_dependants_.push_back(IsDataDependant(call_node));
+
+    Array<Integer> dep_spec = tshape_data_dependant[op];
+    if (dep_spec.size() == 1 && call_node->args.size() > 1) {

Review comment:
       ```suggestion
       if (dep_spec.size() == 1) {
   ```

##########
File path: src/relay/backend/compile_engine.cc
##########
@@ -593,8 +604,10 @@ class MakeShapeFunc : public 
backend::MemoizedExprTranslator<Array<te::Tensor>>
   std::unordered_map<Expr, Array<te::Tensor>, ObjectPtrHash, ObjectPtrEqual> 
param_data_;
   /*! \brief Map from parameter to list of shape placeholder */
   std::unordered_map<Expr, Array<te::Tensor>, ObjectPtrHash, ObjectPtrEqual> 
param_shapes_;
-  /*! \brief Stack of data dependencies for shape function */
+  /*! \brief Stack of data dependencies for shape function, specified per op */
   std::vector<bool> data_dependants_;

Review comment:
       I think you should remove the `data_dependants_` and only use 
`data_dependants_per_input_`.




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

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


Reply via email to