mrdbourke / pytorch-deep-learning

Materials for the Learn PyTorch for Deep Learning: Zero to Mastery course.
https://learnpytorch.io
MIT License
9.34k stars 2.78k forks source link

removed a deprecated method and corrected it accordingly #834

Closed mazarrazi closed 4 months ago

mazarrazi commented 4 months ago

The torch.Tensor.type() method is deprecated. It was used to change the data type of a tensor. However, this method is no longer recommended because it can lead to unexpected results.

Changed the code snippet from using torch.Tensor.type(dtype=None) to tensor = tensor.to(torch.float32) for changing the datatype of tensors. @ line 2189 under the "Change tensor datatype" heading

The link to the documentation has been updated accordingly.