我正在尝试使用官方示例中的预训练词嵌入来实现cnn keras模型,但是使用我自己的自定义数据集。这是网址: https://github.com/fchollet/keras/blob/master/examples/pretrained_word_embeddings.py 我使用Keras 1.2.0和Tensorflow 1.2.1。
我在第132-134行遇到错误。在线搜索后,所有帖子都指出了订购。我尝试了tf和th的建议,但它仍然没有用。
from keras import backend as K
K.set_image_dim_ordering('tf')
有什么想法吗?
File "/home/usr/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2508, in create_op
set_shapes_for_outputs(ret)
File "/home/usr/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1873, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/usr/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1823, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/usr/.local/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/home/usr/.local/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 35 from 15 for 'MaxPool_2' (op: 'MaxPool') with input shapes: [?,15,1,128].