Skip to content

Pytorch - Zero to GANs: Assignment 1 - All About torch.Tensor

Posted on: May 29, 2020 at 12:00 AMMay 29, 2020 at 12:00 AM (2 min read)

I attended the first lecture of the freeOnlineCamp and Jovian.ml Pytorch Deep Learning certification last Saturday. Our first assignment consisted of reading through Pytorch’s documentation and choosing five functions deemed useful.

I chose the following five:

Function 1 - torch.cross()

The cross product in Mathematics refers to an operation on two vector that results in a new vector that’s perpendicular to both of these.

Function 2 - torch.flatten()

This function returns the concatenated elements of the tensor up to the specified dimension.

Function 3 - torch.save()

This functions helps with serialization. Serialization refers to the process of transforming an object into a format that can be stored. This means it’s useful for example when we want to save an object to a disk file for later use.

Function 4 - torch.load()

This functions helps with deserialization. Deserialization refers to the process of transforming stored data (for example a stream of bytes in a file) into an object or data structure that can be understood.

Function 5 - torch.reshape()

The reshape()functions allows to transform any given tensor into a different “shape”. Something important to note here is that it will not modify the data from the tensor, so the tensor will have the same number of elements and the elements will be the same.

Link to the Jupyter notebook I made for the assignment: remusa/01-tensor-operations | Jovian