Tensorflow 1. name_scope和variable_scope有什么区别?

  我们在使用Tensorflow构建深度学习网络模型时,经常会使用name_scope和variable_scope。那么它们的区别体现在哪里呢?

  ① 为了说明以上问题,我们先解释tf.get_variable和tf.Variable的区别:

  1. tf.get_variable: 有同名冲突问题(reuse=True可以解决,同一个);

  2. tf.Variable: 没有同名冲突问题(自动在名字后面加上_1,不是同一个)。

  ② 接下来说明tf.name_scope和tf.variable_scope的区别:

  1. tf.name_scope / tf.op_scope: 给tf.Variable加上prefix,不给tf.get_variable加prefix;

  2. tf.variable_scope / tf.variable_op_scope: 给tf.Variable,tf.get_variable都加prefix。

  PS: 如果tf.name_scope和tf.variable_scope相同,则相同的tf.get_variable没有影响,相同的tf.Variable会在tf.variable_scope prefix后加_1。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值