Fastai library: class learner: fit <--> fit_gen interdepenedcies

I am quite new to Python, so I have a nub’s question while going through the learner.py.
The class has 2 interdependent methods fit and fit_gen.
How it works when:

def fit_gen (…)

return fit(…)

def fit (…)

return fit_gen(…)

???
Thanx for the enlightening.

learner.fit_gen() calls fit(), not learner.fit(). They’re two different functions. fit() is from the module model.py.

(Just posting here because I was wondering the same thing myself, hope it can clear things up for others)

2 Likes