variable_ops_scope和variable_scope有什么区别? [英] What is the difference between variable_ops_scope and variable_scope?
问题描述
在TensorFlow中,有两个范围函数:variable_ops_scope
和variable_scope
.第一个签名如下:
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)
第一个参数values
是什么意思? default_name
仅在name_or_scope
为None
时使用,那么为什么此函数需要采用这两个参数?一个参数就足够了.
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 should be enough.
通常,这两个范围有什么区别?
In general, what is the difference between these two scopes?
推荐答案
variable_ops_scope
是variable_scope
的包装.就像tf.variable_scope
一样,但还要执行2件事:
variable_ops_scope
is a wrapper for variable_scope
. Just like tf.variable_scope
, but performs 2 more things:
-
验证值是否来自同一张图
Validate that values come from the same graph
如果name_or_scope
为None
,则将使用default_name
,并且在需要时将其唯一化.请注意,如果name_or_scope
不是None
,它将被使用但不会被唯一化,并且将不使用default_name
.
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.
这篇关于variable_ops_scope和variable_scope有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!