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

Add OpToNestedTensor (Prototype, for ref) #220

Closed
wants to merge 6 commits into from

Conversation

SagiPolaczek
Copy link
Collaborator

(NOT FOR MERGE)
Hey All,

Following @YoelShoshan's proposal and #219 I implemented some sort of prototype for supporting Nested Tensors.
Note that it requires latest PyTorch version (and it will to do so, since they still working on it). Current version is 1.13.0.

Example of how I used it in a data pipeline (DTI task, so the sequence are differ in size between samples!):

        dynamic_pipeline = [
            # read data
            (OpReadDataframe(data=df, rename_columns=rename_columns, key_column=None), dict()),

            # dummy encoding (ASCII values) and conversion to tensors
            (OpDummyStringToNumbers(), dict(key_in="data.drug.smiles", key_out="data.drug.encoding")),
            (OpDummyStringToNumbers(), dict(key_in="data.target.sequence", key_out="data.target.encoding")),
            (OpToNumpy(), dict(key=["data.drug.encoding", "data.target.encoding"], dtype=np.float32)),
            (OpToTensor(), dict(key=["data.drug.encoding", "data.target.encoding"], dtype=torch.float)),

            # covert to nested tensor
            (OpToNestedTensor(), dict(keys_in=["data.drug.encoding", "data.target.encoding"], key_out="data.input.nested_tensor")),
        ]

@SagiPolaczek SagiPolaczek marked this pull request as draft November 22, 2022 14:46
@SagiPolaczek
Copy link
Collaborator Author

for future ref:
The use of Nested Tensor should be consider to be in the collate phase, and not as a stand-alone op.

thanks @mosheraboh

@SagiPolaczek
Copy link
Collaborator Author

Cleaning PRs

@SagiPolaczek SagiPolaczek deleted the sagi/nested_tensor branch June 27, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant