-
Notifications
You must be signed in to change notification settings - Fork 4
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
Cond wrapper #24
Comments
The example cannot work like this because it requires that we know about the Python local variable name, which we do not. We need to specifically connect both the true-case value and the false-case value such that RETURNN can make it the same layer name. Maybe just disallow to directly access And then require sth like:
So all outputs have to be passed through |
In the way it is written here it seems for me it is more complicated than necessary, because in the end you could reduce it just to: x = ... # whatever
cond = ... # scalar tensor, True or False
y_true = mod_true_case(x)
y_false = mod_false_case(x)
y = Cond(cond, y_true, y_false) Which looks somewhat simpler but has the same expressiveness. As long as there is no possibility for syntax that directly looks like how |
No, it cannot work like that, because it has to be inside some special scope, because you don't want to execute both |
Another API suggestion (draft):
In both the original suggestion and this draft, we have the problem that the first So, maybe:
The arguments to The same written shorter:
Or maybe this is cleaner?
Maybe not because this does not indicate that |
Should this |
Note, Another variant, somewhat more similar to the last example but reducing the overhead slightly:
Re: the side effects of |
Similar as #23, some API with
with Cond(...) as cond_obj:
, which corresponds toif ...:
, and then some furtherwith cond_obj.false_branch():
, which corresponds to theelse:
branch.Example:
But this is not so clear yet.
The text was updated successfully, but these errors were encountered: