1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to TensorFlow in Python

Exercise

Defining variables

Unlike a constant, a variable's value can be modified. This will be useful when we want to train a model by updating its parameters.

Let's try defining and printing a variable. We'll then convert the variable to a numpy array, print again, and check for differences. Note that Variable(), which is used to create a variable tensor, has been imported from tensorflow and is available to use in the exercise.

Instructions

100 XP
  • Define a variable, A1, as the 1-dimensional tensor: [1, 2, 3, 4].
  • Apply .numpy() to A1 and assign it to B1.