在训练深层的网络时,需要大量的变量来保存网络模型,为了减少训练参数个数,需要共享变量,以避免变量名称重复。因此,TensorFlow采用
1.tf.Variable()
2.tf.get_variable()
3.tf.Variable_scope()
4.tf.name_scope()
实现变量功能。
一.tf.Variable()与tf.get_variable()的区别:
tf.Variable()与tf.get_variable()都能创建变量,tf.Variable()会自动检测命名冲突并自动处理,tf.get_variable()遇到重名的变量且没有设置为共享变量时,会报错。
https://www.zhihu.com/question/54513728
http://wiki.jikexueyuan.com/project/tensorflow-zh/how_tos/variable_scope.html