Deep Learning Fundamentals - PyTorch Flashcards
What is PyTorch?
It is a library that help us with essential tools for constructing and training complex models.
What is PyTorch Tensors?
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()
~~~