tf.get_variable. tf.Variable

TensorFlow里创建变量的两种方式有 tf.get_variable() 和 tf.Variable()

在 tf.name_scope下时,tf.get_variable()创建的变量名不受 name_scope 的影响,而且在未指定共享变量时,如果重名会报错,tf.Variable()会自动检测有没有变量重名,如果有则会自行处理。

共享变量,需要使用tf.variable_scope()

猜你喜欢

转载自blog.csdn.net/csdn_lzw/article/details/80981668
今日推荐