ValueError: Error when checking input: expected input_1 to have 2 dimensions, but got array with sha
Posted peng8098
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ValueError: Error when checking input: expected input_1 to have 2 dimensions, but got array with sha相关的知识,希望对你有一定的参考价值。
- 报错
Traceback (most recent call last):
File "D:/PyCharm 5.0.3/WorkSpace/3.Keras/1.Sequential与Model模型、Keras基本结构功能/2_1.py", line 22, in <module>
model.fit(data,labels,epochs=3)
File "D:\Anaconda3\lib\site-packages\keras\engine\training.py", line 952, in fit
batch_size=batch_size)
File "D:\Anaconda3\lib\site-packages\keras\engine\training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "D:\Anaconda3\lib\site-packages\keras\engine\training_utils.py", line 128, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected input_1 to have 2 dimensions, but got array with shape (100, 100, 100, 3)
- 原因
输入第一层的张量与数据集的shape不同 - 解决
shape参数写成:
shape=data.shape
以上是关于ValueError: Error when checking input: expected input_1 to have 2 dimensions, but got array with sha的主要内容,如果未能解决你的问题,请参考以下文章
ValueError: Object arrays cannot be loaded when allow_pickle=False
完美解决:ValueError: Object arrays cannot be loaded when allow_pickle=False
数据分析,使用plt.hist(runtime_data, num_bin_list)时出现ValueError: `bins` must increase monotonically, when a
pandas apply返回多列时出错ValueError: Must have equal len keys and value when setting with an iterable解决方案
pandas apply返回多列时出错ValueError: Must have equal len keys and value when setting with an iterable解决方案