【发布时间】:2019-08-29 23:45:25
【问题描述】:
我尝试学习这个流行的 Tensorflow 教程。
这基本上应该是复制粘贴,但我的代码仍然出错。
我尝试过使用 None 作为形状,但这不起作用。而且由于我对此很陌生,所以我不太确定用谷歌搜索什么。
这是发生错误的代码;
epochs = 10
history = model.fit(train_generator,
epochs=epochs,
validation_data=val_generator)
InvalidArgumentError Traceback (most recent call last)
<ipython-input-15-238fbae26d39> in <module>()
3 history = model.fit(train_generator,
4 epochs=epochs,
----> 5 validation_data=val_generator)
10 frames
/usr/local/lib/python3.6/dist-packages/six.py in raise_from(value, from_value)
InvalidArgumentError: ValueError: `generator` yielded an element of shape (59, 224, 224, 3) where an element of shape (64, 224, 224, 3) was expected.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/script_ops.py", line 235, in __call__
ret = func(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 630, in generator_py_func
"of shape %s was expected." % (ret_array.shape, expected_shape))
ValueError: `generator` yielded an element of shape (59, 224, 224, 3) where an element of shape (64, 224, 224, 3) was expected.
【问题讨论】:
-
请添加有关所述问题的更多信息。
标签: python tensorflow google-colaboratory