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 2021/12/19 02:30:55 UTC

[GitHub] [tvm] junrushao1994 commented on a change in pull request #9764: [TE][TensorIR] fix tensor attr in create_prim_func

junrushao1994 commented on a change in pull request #9764:
URL: https://github.com/apache/tvm/pull/9764#discussion_r771887839



##########
File path: src/te/operation/create_primfunc.cc
##########
@@ -144,7 +145,30 @@ BlockRealize GenerateBlockFromTensor(const te::ComputeOp& compute_op, const te::
   }
 
   // Step 6. Add script_parsing_detect_access attr for auto complete the whole IR.
-  Map<String, ObjectRef> annotations = compute_op->attrs;
+  Map<String, ObjectRef> annotations;
+  auto mutate_attr = [&info](const ObjectRef& value) -> ObjectRef {
+    if (value->IsInstance<te::TensorNode>()) {
+      const auto& tensor_value = Downcast<te::Tensor>(value);
+      auto it = info->tensor2buffers.find(tensor_value);
+      ICHECK(it != info->tensor2buffers.end());
+      return it->second;

Review comment:
       ```suggestion
       if (const auto* tensor_value = value.as<te::TensorNode>()) {
         return info->tensor2buffers.at(GetRef<te::Tensor>(tensor_value));
   ```




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