Keras 有状态 LSTM 批量大小与训练大小警告

时间:2021-04-01 08:34:16

标签: tensorflow keras lstm lstm-stateful

带有 LSTM layer 的 Keras stateful=True 要求 批量大小是训练和测试数据的一小部分,因为 Keras 预先分配了一个数组(see this stack overflow postsee this blog).

如果您不这样做,您将在训练时期结束时获得 incompatible shape error

line 59, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError:  Incompatible shapes: [14,18] vs. [72,18]

如果有更好的警告,例如WARNING: A stateful LSTM requires the number of samples to be a multiple of the batch size. 那么我就不会在我重新调整数据数组时寻找失败。


问题:

作为一个更好的警告可能也有利于其他人试图将 batch_size 从博客中通常看到的 1 增加到更大的东西,我想提出一个请求,将此警告添加到 Keras tensorflow

因为我从未这样做过,所以我不确定请求的正确位置在哪里。由于它既不是错误也不是功能,因此它实际上不属于 tensorflow issues

此外,我没有足够的信心自己解决这个问题并提出拉取请求。

有谁知道应该在哪里(以及是否应该)提出这个请求?


我使用: tensorflow 版本=2.4.1

0 个答案:

没有答案