Fix TCN tuple schema unwrap - #1212
Open
fbonc wants to merge 2 commits into
Open
Conversation
TCN passed raw kwargs (with tuple features) to the embedding model, crashing on StageNetProcessor's (time, value) tuples. Unwrap the 'value' tensor via the processor schema first, like the sibling sequence models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
TCN.forward passed the raw kwargs dict straight to the embedding model (tcn.py:309). Tuple-schema features such as StageNetProcessor arrive as a tuple (time, value), so the embedding model received a tuple and crashed with "'tuple' object has no attribute 'to'". Every sibling sequence model (RNN, CNN, MLP, Transformer, Deepr, MICRON) unwraps the tuple and extracts the value tensor first, so TCN alone was broken for these inputs.
Fix
Before calling the embedding model, TCN now builds an inputs dict by extracting the "value" tensor (and optional "mask") from each feature using the processor's schema(), mirroring RNN. Plain tensor features are wrapped as a one-element tuple so the same schema lookup applies. This leaves the existing sequence/tensor behavior unchanged (their schema is ("value",)) while fixing tuple-schema features.
Notes
Added regression test test_model_with_stagenet_tuple_feature in tests/core/test_tcn.py.