-
Notifications
You must be signed in to change notification settings - Fork 596
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
Make redundant features
argument optional for recurrent cells
#3717
Comments
This feature is needed for |
@cgarciae Isn't shape inference from inputs, as done for the The
That seems more natural and elegant to me, since the number of |
What you are describing is how the Flax recurrent API was before, however it was a bit inconsistent e.g. some classes like |
For recurrent cells such as the following:
LSTMCell
GRUCell
MGUCell
SimpleCell
OptimizedLSTMCell
the
features
argument of the constructor is redundant: It can be inferred from thecarry
input to its__call__
method. (The only cell that currently usesself.features
in its__call__
method isConvLSTMCell
, which ought to be modified to infer it from itscarry
input.)For each cell, the only place where
self.features
is needed is in theinitialize_carry
method. But in many models, the initial carry comes from "upstream" in the model, so this method is never used.Proposal:
Edit
ConvLSTMCell
to inferfeatures
in its__call__
method from itscarry
input.Set
features=None
by default in each cell's constructor.Add the following line to each
initialize_carry
method:I can submit a PR for this, if desired.
An alternative would be to pass
features
directly to theinitialize_carry
method.The text was updated successfully, but these errors were encountered: