Skip to content

replace np.frombuffer with torch.frombuffer in MNIST prototype #4651

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

Merged
merged 12 commits into from
Oct 26, 2021

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Oct 19, 2021

Complement to #4598.

cc @pmeier @bjuncek

Comment on lines +70 to +72
# The MNIST format uses the big endian byte order. If the system uses little endian byte order by default,
# we need to reverse the bytes before we can read them with torch.frombuffer().
needs_byte_reversal = sys.byteorder == "little" and num_bytes_per_value > 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lc0 you also need to take care of that in #4598.

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.

Things a bit more complicated now, but well.

@pmeier pmeier merged commit 29aa38a into main Oct 26, 2021
facebook-github-bot pushed a commit that referenced this pull request Oct 27, 2021
…pe (#4651)

Summary:
* replace np.frombuffer with torch.frombuffer in MNIST prototype

* cleanup

* appease mypy

* more cleanup

* clarify inplace offset

* fix num bytes for floating point data

Reviewed By: NicolasHug

Differential Revision: D31957855

fbshipit-source-id: 0b61f117b74db87c249ff83d9a9a9ed30896130a
@pmeier pmeier deleted the datasets/mnist-frombuffer branch November 8, 2021 14:26
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
…ch#4651)

* replace np.frombuffer with torch.frombuffer in MNIST prototype

* cleanup

* appease mypy

* more cleanup

* clarify inplace offset

* fix num bytes for floating point data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants