在 TensorFlow 中,有两个作用域函数:variable_ops_scope
和 variable_scope
。第一个函数的签名如下:
variable_op_scope(values, name_or_scope, default_name,initializer, regularizer, caching_device, partitioner, reuse)
第一个参数 values
是什么意思?default_name
只有在 name_or_scope
为 None
时才使用,那么为什么这个函数需要这两个参数呢?一个参数应该就够了。
总的来说,这两个作用域有什么区别?
回答:
variable_ops_scope
是 variable_scope
的一个包装器。与 tf.variable_scope
类似,但它还执行以下两项操作:
-
验证值是否来自同一个图
-
如果
name_or_scope
为None
,则使用default_name
,并且在需要时会使其唯一化。请注意,如果name_or_scope
不是None
,它将被使用但不会被唯一化,且default_name
将不会被使用。