Callback

Inheritance Diagram

Inheritance diagram of ashpy.callbacks.callback.Callback

class ashpy.callbacks.callback.Callback(name=None)[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

Methods

on_batch_end(context)

Handle on_batch_end event.

on_batch_start(context)

Handle on_batch_start event.

on_epoch_end(context)

Handle on_epoch_end event.

on_epoch_start(context)

Handle on_epoch_start event.

on_event(event, context)

Handle the on_event event.

on_exception(context)

Handle on_exception event.

on_train_end(context)

Handle on_train_end event.

on_train_start(context)

Handle on_train_start event.

Attributes

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.

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