Counter Callback implementation.
Callback that count events and calls the passed fn evert event_freq.
Count events of a specific type.
CounterCallback(event, fn, name, event_freq=1)¶
Count events of a specific type. Calls fn passing the context every event_freq.
Useful for logging or for measuring performance. If you want to implement a callback defining a certain behaviour every n_events you can just inherit from CounterCallback.
__init__(event, fn, name, event_freq=1)¶
Initialize the CounterCallback.