【发布时间】:2018-01-25 17:44:10
【问题描述】:
我想从预训练模型进行迁移学习。我正在关注 guide 从 Tensorflow 进行再培训。
但是,我遇到了错误tensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes must be equal rank, but are 3 and 2 for 'input_1/BottleneckInputPlaceholder' (op: 'PlaceholderWithDefault') with input shapes: [1,?,128].
# Last layer of pre-trained model
# `[<tf.Tensor 'embeddings:0' shape=(?, 128) dtype=float32>]`
with tf.name_scope('input'):
bottleneck_input = tf.placeholder_with_default(
bottleneck_tensor,
shape=[None, 128],
name='BottleneckInputPlaceholder')
有什么想法吗?
【问题讨论】:
-
bottleneck_tensor的形状是什么?定义bottleneck_input的形状是否也可以打印出来? -
这是预训练模型的最后一层,被列为“embeddings:0 shape=(?, 128)”
-
是的,但我认为你的问题是
bottleneck_tensor的形状。似乎前面有一个额外的维度
标签: python tensorflow