# Different PyTorch’s tensor functions

lets’s see 5 different PyTorch’s built in functions in this article,PyTorch is Developed by Facebook AI Research lab, is widely used as a deep learning framework for many different reasons ranging from easy to use and learning projects to computer vision applications.

1.Tensor

This function allows us to create the tensor of the desired shape and dimension scalar,vector or matrix.

2. Diagonal

This function helps in fixing a desired element in the diagonal position of a matrix.to illustrate the below ex we have used ONE’S and ZERO’S functions which will just create matrix of desired shape with 1’s and 0’s respectively.

3.Reshape

This function helps us to reshape the built matrix into the desired shape of our wish where we use a rand function to create a random function with different values (m*n) where m rows and n columns. which we can reshape into desired shape using the reshape function.

4. Multiply

As multiplication is one of the important usecase s of tensor PyTorch provides us with a inbuilt multiplication function.

5.Unfold

In this operation where we unfold the matrix into the desired way of our wish where we pass 3 parameters such as (Rows,Columns,fold rate),we use a arange function which is similar to the loop function

Final Note:

There are various such functions available in PyTorch Documentation ,This is just a gist of it.