KEMBAR78
Replaced "from_numpy" with "as_tensor" in docs. by sebftw · Pull Request #16587 · pytorch/pytorch · GitHub
Skip to content

Conversation

@sebftw
Copy link
Contributor

@sebftw sebftw commented Jan 31, 2019

📚 Documentation

In the warning box on https://pytorch.org/docs/stable/tensors.html#torch.Tensor.new_tensor it says:

new_tensor() always copies data. [...] If you have a numpy array and want to avoid a copy, use torch.from_numpy().

But then further up the page we have another warning box with the message:

torch.tensor() always copies data. [...] If you have a numpy array and want to avoid a copy, use torch.as_tensor().

Now I believe this is just a small oversight, since from_numpy is to be deprecated in favour of as_tensor. See for example #6885 and #8611. I suggest to just use torch.as_tensor() in both of the warning boxes.

cc @gchanan

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@gchanan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

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.

4 participants