November 2017
Intermediate to advanced
274 pages
6h 16m
English
TensorFlow models may have hundreds of variables. tf.variable_scope() provides a simple name.
To manage the complexity of models and break down into unique pieces, TensorFlow has scopes. Scopes are extremely simple and help when using TensorBoard. Scopes can also be nested inside of other scopes:
with tf.variable_scope("foo"): with tf.variable_scope("bar"): v = tf.get_variable("v", [1]) assert v.name == "foo/bar/v:0" with tf.variable_scope("foo"): v = tf.get_variable("v", [1]) tf.get_variable_scope().reuse_variables() v1 = tf.get_variable("v", [1]) assert v1 == v
The following example shows how to use the reuse option to understand the behavior of get_variable:
#reuse is false with tf.variable_scope("foo"): n = tf.get_variable("n" ...Read now
Unlock full access