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

fix: Fixes inplace target modifications for AbstractDatasets #848

Merged
merged 3 commits into from
Mar 11, 2022

Conversation

fg-mindee
Copy link
Contributor

This PR introduces the following modifications:

  • updates _read_sample to return a deepcopy of the target to prevent inplace modifications
  • adds a dedicated unittest (accessing several times a specific target will return the same value each time now, whether there are inplace transforms or not)

Closes #840

Any feedback is welcome!

@fg-mindee fg-mindee added type: bug Something isn't working critical High priority module: datasets Related to doctr.datasets labels Mar 10, 2022
@fg-mindee fg-mindee added this to the 0.5.1 milestone Mar 10, 2022
@fg-mindee fg-mindee self-assigned this Mar 10, 2022
@codecov
Copy link

codecov bot commented Mar 10, 2022

Codecov Report

Merging #848 (8fa962f) into main (a2b31cc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #848   +/-   ##
=======================================
  Coverage   94.84%   94.84%           
=======================================
  Files         133      133           
  Lines        5195     5197    +2     
=======================================
+ Hits         4927     4929    +2     
  Misses        268      268           
Flag Coverage Δ
unittests 94.84% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
doctr/datasets/datasets/pytorch.py 100.00% <100.00%> (ø)
doctr/datasets/datasets/tensorflow.py 100.00% <100.00%> (ø)
doctr/transforms/functional/base.py 95.65% <0.00%> (ø)

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 a2b31cc...8fa962f. Read the comment docs.

Copy link
Collaborator

@charlesmindee charlesmindee left a comment

Choose a reason for hiding this comment

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

Thanks for spotting this !

@fg-mindee fg-mindee merged commit bc03a0f into main Mar 11, 2022
@fg-mindee fg-mindee deleted the ds-inplace branch March 11, 2022 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical High priority module: datasets Related to doctr.datasets type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[datasets] Targets are modified inplace
2 participants