可能是因为对象类型从
Sequencea
TimeseriesGenerator更改为通用生成器。该
fit_generator功能将这些区别对待。一个更干净的解决方案是继承该类并覆盖处理位:
class CustomGen(TimeseriesGenerator): def __getitem__(self, idx): x, y = super()[idx] # do processing here return x, y
像以前一样使用此类,因为其他内部逻辑将保持不变。

可能是因为对象类型从
Sequencea
TimeseriesGenerator更改为通用生成器。该
fit_generator功能将这些区别对待。一个更干净的解决方案是继承该类并覆盖处理位:
class CustomGen(TimeseriesGenerator): def __getitem__(self, idx): x, y = super()[idx] # do processing here return x, y
像以前一样使用此类,因为其他内部逻辑将保持不变。