November 2018
Intermediate to advanced
322 pages
7h 54m
English
If a variable is defined with a name that has already been used for another variable, then an exception is thrown by TensorFlow. The tf.get_variable() function makes it convenient and safe to create a variable in place of using the tf.Variable() function. The tf.get_variable() function returns a variable that has been defined with a given name. If the variable with the given name does not exist, then it will create the variable with the specified initializer and shape.
Consider the following example:
w = tf.get_variable(name='w',shape=[1],dtype=tf.float32,initializer=[.3])b = tf.get_variable(name='b',shape=[1],dtype=tf.float32,initializer=[-.3])
The initializer can either be a list of values ...
Read now
Unlock full access