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 typehints for .datasets.samplers #2667

Merged
merged 1 commit into from Sep 14, 2020

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Sep 11, 2020

No description provided.

@@ -164,11 +172,10 @@ def __iter__(self):
sampled = torch.randperm(length)[:size] + s
s += length
idxs.append(sampled)
idxs = torch.cat(idxs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This scheme of overriding the variable type was quite common here. In this example idxs was List[torch.Tensor] before, torch.Tensor here, and List[int] later. Thus, I need to rename some variables or merge statements to avoid assignments all together. Otherwise, this will be an even more complicated mess with a lot of casting.

@pmeier pmeier requested a review from fmassa September 11, 2020 13:00
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Thanks!

@fmassa fmassa merged commit 6662b30 into pytorch:master Sep 14, 2020
@pmeier pmeier deleted the typehints-datasets-samplers branch September 15, 2020 05:30
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
@frgfm frgfm mentioned this pull request Oct 26, 2022
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.

None yet

2 participants