This site runs best with JavaScript enabled.Summer of AI

Lesson 0 Project

Learning PyTorch

Complete this project to gain a better understanding of what PyTorch is, and how to use tensors.

If it's still running, kill your Jupyter Notebooks server, and restart it from memory (this is just to give you practice starting up Jupyter Notebooks from scratch)
Make a new notebook called "Lesson 0 Project"
Import PyTorch into that new notebook
The next questions are all about PyTorch tensors. Explore the Official PyTorch Docs to find the right answers.
Make a 3x3 tensor called "a" filled with 0s, and print the contents
HINT:There is a built in PyTorch method to make a tensor filled with zeros
Make a new 3x3 tensors called "b" filled with 1s, and print the contents
Concatenate a and b together, and save that as a tensor called "c". However, instead of concatenating on the 0th dimension (which would produce a 6x3 matrix), concatenate on the 1st dimension, producing a 3x6 matrix. Print the resulting matrix and it's shape.
Print the type of the tensor "c"
Make a new tensor from "c" with the type of "long" instead of "float"
Make a new 3x100x100 tensor "d" filled with random values, and print the result
NOTE:This is how PyTorch represents images: channels x height x width
Print the mean and standard deviation of tensor "d"

Keep Learning!

Check out the PyTorch tensor docs at and find a few math methods to try on the tensors you just made.

Remember: deep learning is mostly about manipulating tensors in one way or another - so the more comfortable you are with looking at them and manipulating them - the easier it will be to learn the rest of PyTorch.