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

Support for Bidirectional Layer #225

Closed
daniel-v-e opened this issue Jan 31, 2022 · 3 comments
Closed

Support for Bidirectional Layer #225

daniel-v-e opened this issue Jan 31, 2022 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@daniel-v-e
Copy link

Could this TCN implementation hypothetically be modified so that it can be wrapped by tf.keras.layers.Bidirectional ?

Currently it is not possible, as layers need the go_backwards attribute in order to be wrapped by the bidirectional layer - see https://www.tensorflow.org/api_docs/python/tf/keras/layers/Bidirectional

@philipperemy
Copy link
Owner

philipperemy commented Feb 1, 2022

@daniel-v-e I am not sure how hard it is to implement it. I forgot a bit how Bidirectional works. Is it concatenating the outputs at each step from two RNNs going forward and backwards? Does it involve "merging" the states (cells) when doing that (I don't think so but just asking)? Because TCN don't have states compared to GRU or LSTM.

If it's just concatenating outputs at each step where each TCN is independent, then it's def do-able. And it would not be so hard. I guess we can just do:

  • We need to add go_backwards in the constructor.
  • If go_backwards=True, we need to flip the time dimension before the TCN layers are called.
  • return_state could just be an empty list?

@philipperemy philipperemy added the help wanted Extra attention is needed label Feb 3, 2022
@philipperemy
Copy link
Owner

@daniel-v-e Bidirect has been implemented.

You can check it here: a412190.

Ref: https://keras.io/examples/nlp/bidirectional_lstm_imdb/

@philipperemy
Copy link
Owner

Pushed in 3.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants