Skip to content

docs: clarify NumPy to tensor conversion semantics#3733

Open
zaydabash wants to merge 5 commits intopytorch:mainfrom
zaydabash:fix/tensors-numpy-wording
Open

docs: clarify NumPy to tensor conversion semantics#3733
zaydabash wants to merge 5 commits intopytorch:mainfrom
zaydabash:fix/tensors-numpy-wording

Conversation

@zaydabash
Copy link

@zaydabash zaydabash commented Jan 20, 2026

This tutorial uses a NumPy array to create a tensor, which can be confusing because some conversion APIs share memory while others copy. This PR adds a short note clarifying that torch.from_numpy shares memory when possible, while torch.tensor makes a copy, and that torch.as_tensor avoids a copy when possible.

cc @albanD @jbschlosser

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 20, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3733

Note: Links to docs will display an error until the docs builds have been completed.

❌ 30 New Failures

As of commit c764e99 with merge base b863c3b (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the cla signed label Jan 20, 2026
@svekars svekars added the core Tutorials of any level of difficulty related to the core pytorch functionality label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed core Tutorials of any level of difficulty related to the core pytorch functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants