Why do we call .detach() before calling .numpy() on a Pytorch Tensor?

I think the most crucial point to understand here is the difference between a torch.tensor and np.ndarray: While both objects are used to store n-dimensional matrices (aka “Tensors”), torch.tensors has an additional “layer” – which is storing the computational graph leading to the associated n-dimensional matrix. So, if you are only interested in efficient and … Read more