【发布时间】:2017-03-16 09:33:14
【问题描述】:
我有一个具有以下一些特征的 TensorFlow 模型:
state_size = 800,
num_classes = 14313,
batch_size = 10,
num_steps = 16, # width of the tensor
num_layers = 3
x = tf.placeholder(tf.int32, [batch_size, num_steps], name='input_placeholder')
y = tf.placeholder(tf.int32, [batch_size, num_steps], name='labels_placeholder')
rnn_inputs = [tf.squeeze(i, squeeze_dims=[1]) for i in
tf.split(x_one_hot, num_steps, 1)] # still a list of tensors (batch_size, num_classes)
...
logits = tf.matmul(rnn_outputs, W) + b
predictions = tf.nn.softmax(logits)
现在我想给它一个 np.array (shape = batch_size x num_steps, 所以 10 x 16) 我得到一个预测张量。
奇怪的是,它的形状是 160 x 14313。后者是类的数量。但是 160 是从哪里来的呢?我不明白。我想对我的每个班级、批次的每个元素(即 10)都有一个概率。 num_steps 是如何参与其中的,我如何从这个 pred 中阅读。张量是这 16 个数字之后的预期元素?
【问题讨论】:
标签: machine-learning tensorflow deep-learning