Inheritance Diagram

Inheritance diagram of ashpy.callbacks.counter_callback.CounterCallback

class ashpy.callbacks.counter_callback.CounterCallback(event, fn, name, event_freq=1)[source]

Bases: ashpy.callbacks.callback.Callback

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]) Initialize the CounterCallback.
on_event(event, context) Count events and calls fn.


name Returns the name of this module as passed or determined in the ctor.
name_scope Returns a tf.name_scope instance for this class.
submodules Sequence of all sub-modules.
trainable_variables Sequence of variables owned by this module and it’s submodules.
variables Sequence of variables owned by this module and it’s submodules.
__init__(event, fn, name, event_freq=1)[source]

Initialize the CounterCallback.

  • event ( – event to count.
  • fn (Callable) – function to call every event_freq events.
  • event_freq (int) – event frequency.
  • name (str) – name of the Callback.

ValueError – if event_freq is not valid.

on_event(event, context)[source]

Count events and calls fn.