I am building a graph where I want the initial weight to have changeable standard deviation. I tried to use the following command but it yielded an error:
import tensorflow as tf
import numpy as np
stddev = tf.placeholder(dtype=tf.float32)
a = tf.placeholder(dtype=tf.float32, shape=[1,50])
weight1 = tf.Variable(tf.truncated_normal(shape=[50, 30],stddev=stddev))
result = tf.reduce_sum(tf.matmul(a, weight1))
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print(sess.run(result , {a: np.random.randn(1, 50), stddev: 0.01}))
Can anyone help me with this issue? I know that I can set stddev when define it, but the task that I am facing is to use a variant stddev during the process of training.
Aucun commentaire:
Enregistrer un commentaire