-
Couldn't load subscription status.
- Fork 19.6k
Closed
Description
EpochIterator initialized with a generator cannot be reset, consequently the following bug might occur: #20394
Another consequence is running prediction on an unbuilt model discards samples:
import os
import numpy as np
os.environ["KERAS_BACKEND"] = "jax"
import keras
set_size = 4
def generator():
for _ in range(set_size):
yield np.ones((1, 4)), np.ones((1, 1))
model = keras.models.Sequential([keras.layers.Dense(1, activation="relu")])
model.compile(loss="mse", optimizer="adam")
y = model.predict(generator())
print(f"There should be {set_size} predictions, there are {len(y)}.")There should be 4 predictions, there are 2.