- tf.get_variable()和tf.Variable()区别?官方文档中tf.get_variable()的解释,Gets an existing variable with these parameters or create a new one, 一般用在tf.variable_scope()中。
def foo():
with tf.variable_scope("foo", reuse=tf.AUTO_REUSE):
v = tf.get_variable("v", [1])
return v
v1 = foo() # Creates v.
v2 = foo() # Gets the same, existing v.
assert v1 == v2
- tf.shape()和tensor.get_shape()有什么区别?推荐使用tf.shape()。tf.shape()的结果为张量,要在sess.run()中才能显示数值结果。get_shape()只能用于张量,返回结果为TensorShape对象,一般通过tensor.get_shape().as_list()转为列表,输入不是张量会报错。参考博文
- tf.name_scope()和tf.variable_scope()的用法区别?参考博文
- tf.get_variable()如果没有指定初始化器,会默认为glorot_uniform_initializer。
- tf.train.AdamOptimizer(learning_rate=0.001, beta1=0.9, beta2=0.999, epsilon=1e-08, use_locking=False,name=‘Adam’)中beta1和beta2的意义?分别为1阶和2阶动量的滑动平均参数。
待解决疑问
- variable变量的重用和管理,还是有些疑惑?reuse参数相互之间是怎么传递的?
- 张量的拆分与合并?tf.concat, tf.split