callback

Callback definition.

Classes

Callback Callback definition.
class ashpy.callbacks.callback.Callback(name)[source]

Bases: tensorflow.python.module.module.Module

Callback definition.

Every callback must extend from this class. This class defines the basic events. Every event takes as input the context in order to use the objects defined. Inheritance from tf.Module is required since callbacks have a state

Order: .. code-block:

--on_train_start

----on_epoch_start

------on_batch_start

------on_batch_end

----on_epoch_end

--on_train_end

on_exception – if an Exception was raised

on_event - Called when an event is triggered
__init__(name)[source]

Initialize the Callback.

Parameters:name (str) – Callback name.

Warning

When using multiple callbacks with the same trainer make sure they have different ids.

Return type:None
name

Return the name of the callback.

on_batch_end(context)[source]

Handle on_batch_end event.

Method called at the end of a batch.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_batch_start(context)[source]

Handle on_batch_start event.

Method called at the beginning of a batch.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_epoch_end(context)[source]

Handle on_epoch_end event.

Method called at the end of an epoch.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_epoch_start(context)[source]

Handle on_epoch_start event.

Method called at the beginning of an epoch.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_event(event, context)[source]

Handle the on_event event.

Method called when an event is triggered.

Parameters:
Return type:

None

on_exception(context)[source]

Handle on_exception event.

Method called when an exception is raised.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_train_end(context)[source]

Handle on_train_end event.

Method called at the end of the training loop.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None
on_train_start(context)[source]

Handle on_train_start event.

Method called at the beginning of the training loop.

Parameters:context (ashpy.contexts.context.Context) – training context
Return type:None