
正文
Tensorflow中的命名空间scope
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
1、name_scope
在tensorflow中有两种声明变量的方式,tf.get_variable()和tf.Variable().
name_scope对于tf.get_variable()无效,只在tf.Variable()中起作用

使用tf.Variable()这种方式创建变量时,首先会检查是否有此时要创建的变量name,如果存在则自动分配一个不同的变量name

2、variable_scope
variable_scope对于tf.get_variable()和tf.Variable()都起作用

tf.Variable()不能使用变量复用的功能,而tf.get_variable()可以实现变量复用的功能










