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

Does AIT handle if/else in forward function? #983

Open
jiangwei221 opened this issue Jan 12, 2024 · 1 comment
Open

Does AIT handle if/else in forward function? #983

jiangwei221 opened this issue Jan 12, 2024 · 1 comment

Comments

@jiangwei221
Copy link

Hi AIT team:

Sorry to bring up this stupid question, but does AIT handles if/else in the forward function?
For example

if x2.mean() > 0:
    x = x + x2
else:
    x = x - x2

If I supply x2 with positive mean when compiling, will the compiled model work with both branches?

Thanks!

@ColinPeppler
Copy link
Contributor

Hi Jiang, is x2 produced by an operator on the graph? If yes, then that's data-dependent control flow and AIT doesn't support that.

One workaround I can think of is this:

x = x + x2 * sign(x2.mean())

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

2 participants