【发布时间】:2018-08-10 06:14:24
【问题描述】:
为什么slim.fully_connected() 会出现此错误?
ValueError: Input 0 of layer fc1 is incompatible with the layer: : expected min_ndim=2, found ndim=1. Full shape received: [32]
我的输入是来自tf.train.batch()的Tensor("batch:0", shape=(32,), dtype=float32)
inputs, labels = tf.train.batch(
[input, label],
batch_size=batch_size,
num_threads=1,
capacity=2 * batch_size)
如果我将输入重塑为(32,1),它可以正常工作。
inputs, targets = load_batch(train_dataset)
print("inputs:", inputs, "targets:", targets)
# inputs: Tensor("batch:0", shape=(32,), dtype=float32) targets: Tensor("batch:1", shape=(32,), dtype=float32)
inputs = tf.reshape(inputs, [-1,1])
targets = tf.reshape(targets, [-1,1])
slim walkthrough 中的示例似乎在 load_batch() 之后无需显式重塑即可工作
【问题讨论】:
标签: tensorflow tf-slim