-
Notifications
You must be signed in to change notification settings - Fork 50
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
Introducing Block #1087
Introducing Block #1087
Conversation
Documentation preview |
if self.accepts_batch: | ||
if self.requires_batch: |
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.
Curious if these two lines can be collapsed into if self.accepts_batch and self.requires_batch
and the rest of this code block be outdented once, or if it's due to quirks of Torchscript?
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.
It's so that if requires_batch
is false, we cast Optional[Batch]
into Batch
and throw an RuntimeException if it's None.
Goals ⚽
First PR for the new PyTorch backend, this PR introduces the following user-facing classes:
Block
Batch
Sequence
And internal classes:
TorchScriptWrapper
BlockContainer
Implementation Details 🚧
TorchScriptWrapper
makes it easier to work with torch-script. It will check the forward method and then stores various properties of it as constants. This way, torchscript doesn't need to worry about it.Testing Details 🔍
Since these are some of the lowest-level classes, I tried to maximize test-coverage as much as possible