def __getitem__(self, idx): """ implemented exclusively for consistency with Keras model.fit. Does not leverage passed idx in any way """ return DataLoader.__next__(self)
def __getitem__(self, idx): """ implemented exclusively for consistency with Keras model.fit. Does not leverage passed idx in any way """ try: return DataLoader.__next__(self) except StopIteration: # TODO: I would like to do a check for idx == 0 # here, but that requires that tf.keras.Model.fit # be called with shuffle=False, and that seems # small enough that it would be too easy to miss # for many users. That said, blind reinitialization # is probably irresponsible, so worth thinking # of something better here DataLoader.__iter__(self) return DataLoader.__next__(self)