Comments (6)
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.
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.
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)
- Broken Link in PyTorch Custom Datasets Notebook HOT 1
- Hey i just reviewed one part of code.
- HuggingFace Spaces Runtime Error
- Getting Started with Tensor flor - scalar.ndim HOT 1
- an error on Batching FashionMNIST figure
- TypeError: 'Tensor' object is not callable HOT 2
- Fix Code Error
- Less accuracy on local machine compare to Colab HOT 1
- The Markdown table formatting is incorrect HOT 1
- PyTorch
- 09 Model development: TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'
- CIFAR 10 dataset
- 05_Pytorch going Modular model_builder.py HOT 1
- 03_pytorch_computer_vision clarification on a comment
- Model not learning
- Where to go from here HOT 1
- Cant find solution to error - Model 2: Training Our First CNN and Evaluating Its Results HOT 1
- Help? Pls HOT 2
- 06 Error with pretrained Model
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-deep-learning.