Giter Club home page Giter Club logo

Comments (6)

Luismbpr avatar Luismbpr commented on September 26, 2024 1

Just found the corrections page for the video here where this point has already been acknowledged: #98

But leaving this open for now as the book description (code lines 65-67 https://www.learnpytorch.io/00_pytorch_fundamentals/#pytorch-tensors-numpy) is still a little misleading.

Thanks for pointing that out.
Good idea.

from pytorch-deep-learning.

Luismbpr avatar Luismbpr commented on September 26, 2024

Hello.
Just wanted to comment this out, since it might also help a little bit to understand of the different DataTypes that they output when using torch.from_numpy() versus torch.Tensor()

Source:
PyTorch memory model: "torch.from_numpy()" vs "torch.Tensor()"

"""
from_numpy() automatically inherits input array dtype. On the other hand, torch.Tensor is an alias for torch.FloatTensor.

Therefore, if you pass int64 array to torch.Tensor, output tensor is float tensor and they wouldn't share the storage. torch.from_numpy gives you torch.LongTensor as expected.

a = np.arange(10)
ft = torch.Tensor(a)  # same as torch.FloatTensor
it = torch.from_numpy(a)

a.dtype  # == dtype('int64')
ft.dtype  # == torch.float32
it.dtype  # == torch.int64

answered Sep 18, 2018 by Viacheslav Kroilov

"""

from pytorch-deep-learning.

pvelayudhan avatar pvelayudhan commented on September 26, 2024

Just found the corrections page for the video here where this point has already been acknowledged: #98

But leaving this open for now as the book description (code lines 65-67 https://www.learnpytorch.io/00_pytorch_fundamentals/#pytorch-tensors-numpy) is still a little misleading.

from pytorch-deep-learning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.