为什么get_weights()返回的权重值与实际权重相比不同?我认为初始化后,这两种方法应显示相同的权重。import tensorflow as tfimport ossess = tf.Session()x = tf.placeholder(tf.float32, shape=[None, 3])linear_model = tf.layers.Dense(units=1,use_bias=False,activation=None)y = linear_model(x)init = tf.global_variables_initializer()sess.run(init)print(linear_model.get_weights())print(sess.run(linear_model.weights))print('------------------')print(sess.run(y, {x: [[1, 1, 1]]}))输出[array([[-0.26290017], [ 0.11782396], [ 0.51118207]], dtype=float32)][array([[-0.12011003], [ 0.13160932], [ 1.1303514 ]], dtype=float32)]------------------[[1.1418507]]
添加回答
举报
0/150
提交
取消