Context

Inheritance Diagram

Inheritance diagram of ashpy.contexts.context.Context

class ashpy.contexts.context.Context(metrics=None, dataset=None, log_eval_mode=<LogEvalMode.TEST: 1>, global_step=<tf.Variable 'global_step:0' shape=() dtype=int64, numpy=0>, checkpoint=None)[source]

Bases: object

ashpy.contexts.Context provide an interface for all contexts.

Methods

__init__([metrics, dataset, log_eval_mode, …]) Initialize the Context.

Attributes

current_batch Return the current batch.
dataset Retrieve the dataset.
exception Return the exception.
global_step Retrieve the global_step.
log_eval_mode Retrieve model(s) mode.
metrics Retrieve the metrics.
__init__(metrics=None, dataset=None, log_eval_mode=<LogEvalMode.TEST: 1>, global_step=<tf.Variable 'global_step:0' shape=() dtype=int64, numpy=0>, checkpoint=None)[source]

Initialize the Context.

Parameters:
Return type:

None

current_batch

Return the current batch.

Return type:Optional[Tensor]
dataset

Retrieve the dataset.

Return type:DatasetV2
Returns:tf.data.Dataset the current dataset
exception

Return the exception.

Return type:Optional[Exception]
global_step

Retrieve the global_step.

Return type:Variable
Returns:tf.Variable.
log_eval_mode

Retrieve model(s) mode.

Return type:LogEvalMode
Returns:ashpy.modes.LogEvalMode.
metrics

Retrieve the metrics.

Return type:Tuple[Metric]
Returns:tuple of (ashpy.metrics.metric.Metric).