-
-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Allow for more flexible shapes #396
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
Merged
Merged
Conversation
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
sebffischer
commented
Apr 25, 2025
sebffischer
commented
Apr 25, 2025
NEWS.md
Outdated
@@ -16,6 +16,7 @@ | |||
* feat: TabResNet learner now supports lazy tensors. | |||
* feat: The `LearnerTorch` base class now supports the private method `$.ingress_tokens(task, param_vals)` | |||
for generating the `torch::dataset`. | |||
* feat: Shapes can now have multiple `NA`s and not only the batch dimension can be missing. However, most `nn()` operators still expect only one missing values and will throw an error if multiple dimensions are missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
* feat: Shapes can now have multiple `NA`s and not only the batch dimension can be missing. However, most `nn()` operators still expect only one missing values and will throw an error if multiple dimensions are missing. | |
* feat: Shapes can now have multiple `NA`s and not only the batch dimension can be missing. However, most `nn()` operators still expect only one missing values and will throw an error if multiple dimensions are missing. | |
* feat: better inferring of output shapes via function `infer_shapes()`. |
sebffischer
commented
Apr 25, 2025
sebffischer
commented
Apr 25, 2025
sebffischer
commented
Apr 25, 2025
sebffischer
commented
Apr 25, 2025
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.
Previously, only the batch dimension was allowed to be
NA
.However, this assumption is too restrictive, as it does not allow for transformer-based architectures where the sequence dimension is unknown.
This PR changes this and
NA
s can now be at every position of theshape
.However, many
nn()
operators expect only the batch dimension to be unknown.Therefore, the
only_batch_unknown
argument was added toPipeOpTorch
that isTRUE
by default and needs to be overwritten.E.g.
PipeOpTorchLinear
can handleNA
s, as long as they are now in the last dimension.Other operators that can handle it are, e.g., activation functions or in the future the multihead-attention module.
This PR also improved the shape inference and fixed some other small bugs.
TODOs:
infer_shapes()
method must be adjusted. Now, we replace allNA
s dimensions with an arbitrary dimension.we should also do this twice to check whether the results are compatible
assert_shape()
and verify that we no longer make the assumption that only the batch dimension isNA
PipeOpTorch
object implementations that they err gracefully -->PipeOpTorch
now need to indicate whether they can handleNA
s that are not in the batch dimension.