Skip to content

Add Storage.from_buffer - #9

Merged
soumith merged 1 commit into
pytorch:masterfrom
colesbury:develop
Sep 7, 2016
Merged

soumith merged 1 commit into
pytorch:masterfrom
colesbury:develop

Conversation

@colesbury

@colesbury colesbury commented Sep 7, 2016 •

Copy link
Copy Markdown
Contributor

The from_buffer is similar to numpy's frombuffer. It decodes a Python
buffer object into a Storage object. For byte and char storages, it
simply copies the bytes.

@soumith

soumith commented Sep 7, 2016 •

Copy link
Copy Markdown
Collaborator

Comment thread torch/csrc/generic/StorageMethods.cpp Outdated
THPByteOrder byte_order;
if (strcmp(byte_order_str, "native") == 0) {
byte_order = THP_nativeByteOrder();
} else if (strcmp(byte_order_str, "be") == 0) {

This comment was marked as off-topic.

@colesbury colesbury changed the title Add Storage.frombuffer Add Storage.from_buffer Sep 7, 2016
@soumith soumith closed this Sep 7, 2016
@soumith soumith reopened this Sep 7, 2016
@soumith soumith closed this Sep 7, 2016
@soumith soumith reopened this Sep 7, 2016
@soumith

soumith commented Sep 7, 2016

Copy link
Copy Markdown
Collaborator

ok tests pass. @apaszke good to go?

@apaszke

apaszke commented Sep 7, 2016

Copy link
Copy Markdown
Contributor

It still gives some compiler warnings. @colesbury could you please take a look?

@colesbury

Copy link
Copy Markdown
Contributor Author

(Fixed build warning)

The from_buffer is similar to numpy's frombuffer. It decodes a Python
buffer object into a Storage object. For byte and char storages, it
simply copies the bytes.
@colesbury

Copy link
Copy Markdown
Contributor Author

I have no idea what I'm doing

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