def METHOD_NAME(cls, capfd):
    import tensorflow as tf
    with capfd.disabled():
        o = CapList()
        r = cls("stdout", [o.append])
        model = tf.keras.models.Sequential()
        model.add(tf.keras.layers.Dense(10, input_dim=10))
        model.compile(loss="mse", optimizer="sgd")
        r.install()
        epochs = 5
        model.fit(np.zeros((10000, 10)), np.ones((10000, 10)), epochs=epochs)
        r.uninstall()
        assert len(o) in (epochs * 2, epochs * 2 + 1)  # Allow 1 offs