Callback¶
Inheritance Diagram
-
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 stateOrder: .. 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
__init__
(name)Initialize the Callback. 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
Return the name of the callback. 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__
(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 contextReturn 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 contextReturn 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 contextReturn 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 contextReturn type: None
-
on_event
(event, context)[source]¶ Handle the on_event event.
Method called when an event is triggered.
Parameters: - event (
ashpy.callbacks.events.Event
) – triggered event - context (
ashpy.contexts.context.Context
) – training context
Return type: None
- event (
-
on_exception
(context)[source]¶ Handle on_exception event.
Method called when an exception is raised.
Parameters: context ( ashpy.contexts.context.Context
) – training contextReturn 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 contextReturn 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 contextReturn type: None
-