Variables, constants, and placeholders
Variables, constants, and placeholders are fundamental elements of TensorFlow. However, there is always confusion between these three. Let's look at each element, one by one, and learn the difference between them.
Variables
Variables are containers used to store values. Variables are used as input to several other operations in a computational graph. A variable can be created using the tf.Variable()
function, as shown in the following code:
x = tf.Variable(13)
Let's create a variable called W
, using tf.Variable()
, as follows:
W = tf.Variable(tf.random_normal([500, 111], stddev=0.35), name="weights")
As you can see in the preceding code, we create a variable, W
, by randomly drawing values from a normal distribution with a standard deviation of 0.35
.
What is that name
parameter in tf.Variable()
?
It is used to set the name of the variable in the computational graph. So, in the preceding code...