Skip to content

Conversation

mikekgfb
Copy link
Contributor

@mikekgfb mikekgfb commented May 4, 2023

Summary: Add unit test for nested_tensor input & fix

Test Plan: sandcastle

Differential Revision: D45580393

@pytorch-bot
Copy link

pytorch-bot bot commented May 4, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/100650

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 7328bed:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb changed the title Add unit test for nested_tensor input & fix Add unit test for nested_tensor input to TransformerEncoder May 4, 2023
@mikekgfb mikekgfb changed the title Add unit test for nested_tensor input to TransformerEncoder Add unit test for nested_tensor input to nn.TransformerEncoder May 4, 2023
Copy link
Contributor

@jbschlosser jbschlosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just move the output.size() call here:

if convert_to_nested:
output = output.to_padded_tensor(0., output_size)

output_size isn't used anywhere else AFAICT.

@mikekgfb
Copy link
Contributor Author

mikekgfb commented May 4, 2023

Why not just move the output.size() call here:

if convert_to_nested:
output = output.to_padded_tensor(0., output_size)

output_size isn't used anywhere else AFAICT.

Good point!

One consideration - do we benefit from not having src live until the end of the TransformerEncoder stack?

@jbschlosser
Copy link
Contributor

That is correct. What change are you suggesting?

Maybe something like this:

if convert_to_nested: 
     output = output.to_padded_tensor(0., src.size()) 

@mikekgfb
Copy link
Contributor Author

mikekgfb commented May 4, 2023

That is correct. What change are you suggesting?

Maybe something like this:

if convert_to_nested: 
     output = output.to_padded_tensor(0., src.size()) 

Yes, this makes sense - great point and simplifies code!

Would increasing the defined-use range for src across TransformerEncoder be a concern?
We concluded it does not, because the caller would still have a reference preventing GC

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch from c1630ae to 7a1139e Compare May 4, 2023 20:16
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch from 7a1139e to b931500 Compare May 4, 2023 20:27
@mikekgfb mikekgfb added better-engineering Relatively self-contained tasks for better engineering contributors topic: not user facing topic category bug labels May 4, 2023
@mikekgfb
Copy link
Contributor Author

mikekgfb commented May 4, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 4, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-12-py3-arm64 / test (default, 2, 3, macos-m1-12)

Details for Dev Infra team Raised by workflow job

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch from 1be5f54 to 46a25be Compare May 5, 2023 14:10
@albanD albanD removed their request for review May 5, 2023 14:13
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch 2 times, most recently from 2c092c0 to 301d1d2 Compare May 5, 2023 16:21
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch from 301d1d2 to f389c45 Compare May 5, 2023 17:33
mikekgfb pushed a commit to mikekgfb/pytorch that referenced this pull request May 5, 2023
Summary:
Pull Request resolved: pytorch#100650

Add unit test for nested_tensor input & fix

Test Plan: sandcastle

Differential Revision: D45580393

fbshipit-source-id: 2f5d5ac1064c8810d28d11fa769fd2ff34693b2b
@mikekgfb mikekgfb force-pushed the export-D45580393 branch from f389c45 to 43db8f9 Compare May 5, 2023 17:42
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb mikekgfb force-pushed the export-D45580393 branch from 43db8f9 to 1c2a6d9 Compare May 5, 2023 20:24
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

Summary:
Pull Request resolved: pytorch#100650

Add unit test for nested_tensor input & fix

Test Plan: sandcastle

Differential Revision: D45580393

fbshipit-source-id: bbbee84c004c928b55870ac60970a8d38c0cba0e
@mikekgfb mikekgfb force-pushed the export-D45580393 branch from 1c2a6d9 to 7328bed Compare May 5, 2023 20:32
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D45580393

@mikekgfb
Copy link
Contributor Author

mikekgfb commented May 5, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

better-engineering Relatively self-contained tasks for better engineering contributors ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants