In the previous segment, you learnt how to declare tensors of the tf.constant type.

In the next video, you will learn about a different way of declaring tensors.

Let’s summarise what was covered in the video:

- You can use tf.Variable in the same way as tf.constant to initialise a tensor with the values that you can pass in a list. However, in the case of variables, these values can be changed later as well.
- You can also specify the data type while initialising the tensor. In this way, you can be sure of the data type. Although this might seem trivial now, in the upcoming segments, you will learn about the importance of declaring the data type.
- You can access the values of a tensor directly using the .numpy() function. It will return the values of the tensor as a NumPy array.

So far, you have learnt about many different ways to declare a tensor. Now, open a Google Collab file and try to answer this question.

## Exercise

**Declare a tensor of shape (2, 2, 2, 2) with random numbers from a normal distribution whose mean and standard deviation are both 1.**

First, let’s see how you will get the required tensor using NumPy.

Now, you will learn how to get the required tensor with a mean and standard deviation of 1 using tensorflow directly.

Now, answer these questions based on what you learnt in this segment.

In the next segment, you will explore the mathematical capabilities of TensorFlow.

Report an error