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

Remove duplicate code #1125

Merged
merged 2 commits into from
Jul 16, 2019
Merged

Remove duplicate code #1125

merged 2 commits into from
Jul 16, 2019

Conversation

zhiqwang
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Jul 16, 2019

Codecov Report

Merging #1125 into master will increase coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1125      +/-   ##
==========================================
+ Coverage   64.79%   64.84%   +0.04%     
==========================================
  Files          68       68              
  Lines        5417     5413       -4     
  Branches      835      835              
==========================================
  Hits         3510     3510              
+ Misses       1648     1645       -3     
+ Partials      259      258       -1
Impacted Files Coverage Δ
torchvision/datasets/fakedata.py 26.92% <0%> (+3.58%) ⬆️
torchvision/transforms/transforms.py 80.35% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d580a1...ca24311. Read the comment docs.

@@ -22,8 +22,6 @@ class FakeData(VisionDataset):
def __init__(self, size=1000, image_size=(3, 224, 224), num_classes=10,
transform=None, target_transform=None, random_offset=0):
super(FakeData, self).__init__(None)
self.transform = transform
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be even better if you deleted both occurrences and passed transform and target_transform to the constructor of the parent class.

def __init__(self, root, transforms=None, transform=None, target_transform=None):

Copy link
Contributor Author

@zhiqwang zhiqwang Jul 16, 2019

Choose a reason for hiding this comment

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

Done. Thanks for this suggestion. In cifar.py, caltech.py etc, I didn't look for all datasets, is it necessary to pass transform and target_transform to the constructor? If yes, I'm appreciate to do this in this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this should be done in every dataset, since @fmassa implemented it in #872.

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 8837e0e into pytorch:master Jul 16, 2019
@zhiqwang zhiqwang deleted the patch-1 branch July 16, 2019 08:41
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.

4 participants