Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions beginner_source/basics/tensorqs_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
# Tensors can be created from NumPy arrays (and vice versa - see :ref:`bridge-to-np-label`).
np_array = np.array(data)
x_np = torch.from_numpy(np_array)
# Note: torch.from_numpy shares memory with the NumPy array when possible. If you want a copy, use torch.tensor(np_array).
# torch.as_tensor(np_array) also avoids a copy when possible.


###############################################################
Expand Down
Loading