yongwww commented on code in PR #14123:
URL: https://github.com/apache/tvm/pull/14123#discussion_r1119003108
##########
python/tvm/script/ir_builder/relax/ir.py:
##########
@@ -325,6 +327,35 @@ def emit(value: Expr, annotate_struct_info:
Optional[StructInfo] = None) -> Var:
return _ffi_api.Emit(value, annotate_struct_info) # type:
ignore[attr-defined] # pylint: disable=no-member
+def emit_te(func: Callable, *args: Any, **kwargs: Any) -> Var:
+ """Emit a call node according to the te function.
+ This function converts arguments from relax expression to te tensor,
+ The callback func should return a te tensor or a list of te tensors.
+
+ Parameters
+ ----------
+ func : Callable
+ A function that returns a te tensor or a list of te tensors.
+
+ args : Any, optional
+ arguments passed to the function.
+
+ kwargs : Any, optional
+ The keyword arguments passed to the function.
+ Note that the key "primfunc_name_hint" is reserved for passing name
hint
+ to the PrimFunc that gets generated.
+
+ Returns
+ -------
+ var : Var
+ A newly created variable that gets bound to the call code.
+ """
+
+ # Levarage the util function call_te in Relax Block Blocker
+ emit_expr = rx_bb().call_te(func, *args, **kwargs)
Review Comment:
Yes, the actual emit happens later. Actually the call_te is just a helper
function, it is used to help prepare the expr to be emitted later.
--
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]