【发布时间】:2017-02-23 23:01:13
【问题描述】:
我尝试创建一个具有动态形状的 tf.Variable。下面概述了这个问题。
这样做很有效。
init_bias = tf.random_uniform(shape=[self.config.hidden_layer_size, tf.shape(self.question_inputs)[0]])
但是,当我尝试这样做时:
init_bias = tf.Variable(init_bias)
它抛出错误 ValueError: initial_value must have a shape specified: Tensor("random_uniform:0", shape=(?, ?), dtype=float32)
刚来上下文(问题输入是一个占位符,动态批处理):
self.question_inputs = tf.placeholder(tf.int32, shape=[None, self.config.qmax])
似乎将动态值放入随机统一会给出 shape=(?,?) 这会导致 tf.Variable 出现错误。
感谢并感谢任何帮助!
【问题讨论】:
标签: tensorflow