Cannot understand on_batch_end Callback

I am a Callbacks newbie; I followed the great intro to Callbacks by @lgvaz and I am not sure why the on_batch_end does not print anything.

class PrintCallback(Callback):
    def on_batch_end(self): print('After batch')
    def after_epoch(self): print('After epoch')
    def begin_fit(self): print('Beginning fit')

learn = cnn_learner(dls, resnet34, metrics=accuracy, cbs=PrintCallback())
learn.fit_one_cycle(1, lr_max=1e-2)

image

What am I missing?
Thanks!

I don’t think there is a on_batch_end callback, maybe try after_batch.

You can check the available callbacks here

Thanks for the reply!
What is this one then?

That’s fastai v1 docs :sweat_smile:

1 Like

Ah! Am I looking at the wrong docs?

Great! after_batch works, thanks!
I have literally spent hours trying to debug the wrong code base… :smiley:
Pretty amazing experience

1 Like

For context, I am trying to implement a variant of AUC.
This is where all of this is coming from.

1 Like

Docs of v2 are here.

1 Like

Thanks!