Deep Learning Fundamentals - PyTorch Flashcards
1
Q
What is PyTorch?
A
It is a library that help us with essential tools for constructing and training complex models.
2
Q
What is PyTorch Tensors?
A
They are multi-dimensional arrays (vectors and matrixes with the capacility to have more than two dimensions).
They facilitate the storage and manipulation of data.
They handle numerical operations efficiently and are essential for matrix operations commonly found in linear algebra, which underpin many algorithms in deep learning.
Sample code using a tensor:
import torch Create a 3-dimensional tensor images = torch. rand ( (4, 28, 28)) Get the second image second_image = images[1] import matplotlib.pyplot as plt # Display the image plt. imshow (second_image, cmap='gray') plt.axis( 'off') # disable axes plt.show()