electriclilies commented on a change in pull request #9533:
URL: https://github.com/apache/tvm/pull/9533#discussion_r752686209



##########
File path: src/relay/ir/expr.cc
##########
@@ -71,6 +71,29 @@ Tuple::Tuple(tvm::Array<relay::Expr> fields, Span span) {
   data_ = std::move(n);
 }
 
+Tuple Tuple::WithFields(Optional<Array<Expr>> opt_fields, Optional<Span> 
opt_span) {
+  Array<Expr> fields = opt_fields.value_or(get()->fields);

Review comment:
       OK, thanks for the feedback. I just changed the signature to be similar 
to WithAttrs and I removed the COW functionality. Now it will return the 
argument tuple if all the fields passed in are the same, otherwise it creates a 
copy and returns that.

##########
File path: src/relay/ir/expr.cc
##########
@@ -71,6 +71,29 @@ Tuple::Tuple(tvm::Array<relay::Expr> fields, Span span) {
   data_ = std::move(n);
 }
 
+Tuple Tuple::WithFields(Optional<Array<Expr>> opt_fields, Optional<Span> 
opt_span) {
+  Array<Expr> fields = opt_fields.value_or(get()->fields);

Review comment:
       OK, thanks for the feedback. I just changed the signature to mirror 
WithAttrs and I removed the COW functionality. Now it will return the argument 
tuple if all the fields passed in are the same, otherwise it creates a copy and 
returns that.




-- 
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: [email protected]

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


Reply via email to