Difference between variable_ops_scope and variable

2019-09-05 08:18发布

问题:

In tensorflow, there are two scope functions: variable_ops_scope and variable_scope. The first one has a signature as following:

variable_op_scope(values,name_or_scope,default_name,initializer, regularizer,caching_device, partitioner,reuse)

What does the first parameter "values" mean? "default_name" is only used when name_or_scope is None, so why this function need to take these two parameters? One parameter is enough...

In general, what is the difference between these two scopes?

回答1:

variable_ops_scope is a wrapper for variable_scope. Just like tf.variable_scope, it but performs 2 more things:

(1) Validate that values come from the same graph, (2) If name_or_scope is None, the default_name will be used and will be uniquified if needed. Note that if name_or_scope is not None, it will be used and but not be uniquified, and default_name will not be used.