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/11/23 23:40:45 UTC

[GitHub] [tvm] mbs-octoml commented on a change in pull request #9569: [Relay] WithFields method for Call, Function, Var, TupleGetItem, If, Let, RefCreate, RefRead, RefWrite, Match, and Clause

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



##########
File path: include/tvm/relay/expr.h
##########
@@ -319,8 +337,31 @@ class Call : public Expr {
                Array<Type> type_args = Array<Type>(), Span span = Span());
 
   TVM_DEFINE_OBJECT_REF_METHODS(Call, RelayExpr, CallNode);
+  TVM_DEFINE_OBJECT_REF_COW_METHOD(CallNode);
 };
 
+/*!
+ * \brief Returns the call with given properties. A null property denotes 'no change'.
+ * Returns call if all properties are unchanged. Otherwise, returns a copy with the new fields.
+ * \param call The call to copy.
+ * \param opt_op The (optional) op for the copied call. If none, ret_call->op = call->op.
+ * \param opt_args The (optional) args for the copied call. If none, ret_call->args = call->args.
+ * \param opt_attrs The (optional) attrs for the copied call. If none, ret_call->attrs =
+ * call->attrs.
+ * \param opt_type_args The (optional) type args for the copied call. If none,
+ * ret_call->type_args = call->type_args.
+ * \param opt_span The (optional) span for the copied call. If none, ret_call->span = call->span.
+ * \return If all properties are null or the same as the property in the input call
+ * (i.e., opt_op is null or opt_op.value() == call->op, etc.), then we return call. Otherwise, we
+ * return a copy of call with the different fields overwritten. (i.e., if opt_op.value() !=
+ * call->op, then ret_call->op = opt_op.value()).
+ */
+Call WithFields(Call call, Optional<Expr> opt_op = Optional<Expr>(),
+                Optional<Array<Expr>> opt_args = Optional<Array<Expr>>(),
+                Optional<Attrs> opt_attrs = Optional<Attrs>(),
+                Optional<Array<Type>> opt_type_args = Optional<Array<Type>>(),
+                Optional<Span> opt_span = Optional<Span>(nullptr));

Review comment:
       don't need the nullptr arg apparently




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