-
-
Notifications
You must be signed in to change notification settings - Fork 456
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 tf.RaggedTensor Input #185
Comments
@mimxrt not sure exactly why it does not work. This should work in theory: m_in = K.Input(shape=(None, 2), batch_size=batch_size, ragged=True) |
I'm not sure why but it doesn't work for me. I also made sure to get the latest version of TensorFlow this time! Can you try and run this example?
Output for me:
|
@mimxrt yes it does not work for me too. But seems like it's a Keras issue here. |
Thanks for testing! I created another script that shows that it works by simply using
Output:
Is there anything that I need to configure properly to make it work with TCNs? |
I'd say it's because we have a custom function to build() the network. The support for RaggedTensor should be about updating this function. That's my gut feeling. |
Maybe it also has something todo with this issue: tensorflow/tensorflow#42417? However, I also don't really know what's the technical difficulty as in my understanding everything that supports |
Yes, I think you are right here. It's related. I'll see what I can do ;) |
@mimxrt |
@maximgeller I think you might have misunderstood my statement: I meant if masking is supported (i.e., everything that supports |
The correct way to do that is here: https://www.tensorflow.org/guide/keras/masking_and_padding Doc: https://stackoverflow.com/questions/55176818/how-to-support-masking-in-custom-tf-keras-layers-layer |
Currentrly, Keras TCN does not support
tf.RaggedTensor
input. It would be very useful for speeding up training for variying length time series inputs.As I understand it, there is no way to batch sequences of different lengths except when using*. See the following minimal example of the current state:tf.RaggedTensor
*EDIT: Masking is another option, but still...
Output:
I think this is expected to fail in all cases because I did not add the
ragged=True
parameter. When adding this parameter, the error is as expected (Layer tcn_1 does not support RaggedTensors as input
):Output:
The text was updated successfully, but these errors were encountered: