 What the Hell is “Tensor” in “TensorFlow”? by@sagarsharma4244

# What the Hell is “Tensor” in “TensorFlow”?

## I didn’t know it…

We all know how to work with tensorflow library and make some amazing models like “cat-dog gif below” leading to great predictions 💯. But what the hell is a tensor?

Maybe you know it… But I didn’t know it.

Updated-Deep Learning is an attempt to copy the pattern detection ability of a human brain, the main cause of pattern detection is Neural Networks in our brain.

#### What is Tensor?

It is just a general term for unit of data. Duh… we all know it…

It is also represented with a Rank, like in Matrix. They are geometric objects that describe linear relations between geometric vectors, scalars, and other tensors.

Updated-A tensor consists of a set of primitive values shaped into an array of any number of dimensions.

#### But which type of data, Scalar or Vector?

If you think like me, that it is an upgrade of vectors like vectors is an upgrade to scalars. Then no, you are wrong. Both the quantities Scalar and Vector are Tensors.

#### What is a Rank or Tensor’s Rank?

The number of dimensions used to represent the data is known as its Rank.

#### How does it look?

Updated-

rank/dimension zero tensor or a Scalar.

``  5        # The shape is []``

A rank/dimension 1 tensor or a Vector.

``  [ 1., 2., 3., 4. ]     # The shape is ``

A rank/dimension 2 tensor or a Matrix. This is 2D just like a photo with X axis and Y axis.

` # Matrix of shape [ 2, 4]  [ [ 1., 2., 3., 4. ], [ 5., 6., 7., 8. ] ]`

A rank/dimension 3 tensor or a Tensor. This is 3D just like real world with X, Y and Z axis. Simply, it is just matrices inside a bigger matrix.

` # Tensor of shape [ 2, 1, 4 ]`
` [ [ [ 1., 2., 3., 4. ] ], [ [ 5., 6., 7., 8. ] ] ] `

This is how you can increase the dimensionality of a tensor. 😃

Tensor a mathematical object analogous to but more general than a vector, represented by an array of components that are functions of the coordinates of a space.

Any comments or if you have any question, write it in the comments.

I will be posting 3 posts per week so don’t miss the tutorial.

Clap it! Share it! Follow Me!

### Previous stories you will love:

1. Cross- Validation Code Visualization: Kind of Fun                Join Hacker Noon