Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call for ifExp supporting #8

Open
ShouyangDong opened this issue Sep 27, 2021 · 3 comments
Open

Call for ifExp supporting #8

ShouyangDong opened this issue Sep 27, 2021 · 3 comments

Comments

@ShouyangDong
Copy link

Right now I am working on the parser of tvm.tir.script, but a minor question that I met is about tvm.tir.Select. This function is related to IfExp node. When will be IfExp node supported in synr? Thank you.

@junrushao
Copy link

Hey thanks for asking! I believe tir.Select is a bit different from tir.IfThenElse in terms of semantics. @Hzfengsy would you like to confirm?

To make sure I understand this question, are you asking if it is possible to translate python's XXX if CCC else YYY expression to tir.IfThenElse?

@Hzfengsy
Copy link
Contributor

IfThenElseNode is a stmt with two sub-stmt then_case and else_case, it equals to

if condition:
    then_case
else:
    else_case

tir.Select is an expr with true_value and false_value, which equals to

true_value if condition else false_value

IIRC, it is not supported by now. I can support it when I have time.

@ShouyangDong
Copy link
Author

Thank you @junrushao1994 and @Hzfengsy. true_value if condition else false_value is quite important when I process these control flow of Scalars.
By the way, do you have any plan to support cross function calls? I take the code snippet below for example,

def A():
   return 0

def main():
     a  = A ()

That will be quite useful when we implement these long tail operators like nms and region_proposal, etc. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants