Skip to content

Why the tensor has been changed when I change the array? I'm confused! #124

Discussion options

You must be logged in to vote

I had the same doubt when going through the video; the point should be the following:

The returned tensor and ndarray share the same memory. Modifications to the tensor will be reflected in the ndarray and vice versa.

i.e. modifications to the numpy array from which the torch tensor is created get reflected into the tensor itself (as in your first and third example).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mrdbourke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants