context¶
Primitive Context Interface.
Contexts
are checkpointable (subclassed from tf.train.Checkpoint
)
collections of variable encapsulated in a Python Class as a way to seamlessly
handle information transfer.
Classes
Context |
ashpy.contexts.Context provide an interface for all contexts. |
-
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.-
__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: - metrics (
tuple
of (ashpy.metrics.metric.Metric
)) – List ofashpy.metrics.metric.Metric
objects. - dataset (
tf.data.Dataset
) – The dataset to use, that contains everything needed to use the model in this context. - log_eval_mode (
ashpy.modes.LogEvalMode
) – Models’ mode to use when evaluating and logging. - global_step (
tf.Variable
) – Keeps track of the training steps. - checkpoint (
tf.train.Checkpoint
) – Checkpoint to use to keep track of models status.
Return type: None
- metrics (
-
dataset
¶ Retrieve the dataset.
Return type: DatasetV2
Returns: tf.data.Dataset
the current dataset
-
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
).
-