Understanding Callbacks refactoring

hi all
please help understand below things in call back

  1. what is the significance of res below. We have res defined in every event

     def after_backward(self):
             res = True
             for cb in self.cbs:
               res = res and cb.after_backward()
  2. in which case one would want to return false
    if not cb.begin_epoch(epoch): continue

you could fx develop a callback for early stopping that returns false when the criteria for stopping is meet

Thanks few more things that is bothering me

  1. In every event method we have this res used in the same way
    for cb in self.cbs: res = res and

Why do we need res (hardcoded to true) when we are only interested activities in the event methods like begin/after ?

  1. inside fit ,all batches,one batch from wherever we call event methods we have got
    if Not condition return or continue…
    what if dont want to do any early stopping and do any other acitivities.

Actually, for what I understood, callbacks use a reverse logic: False means keep going and True stop. This is why we have if not cb.blabla .
Moreover, the return True will be deprecated in favor of Exception.

1 Like