mindspore.dataset.DSCallback
- class mindspore.dataset.DSCallback(step_size=1)[source]
Abstract base class used to build a dataset callback class.
- Parameters
step_size (int, optional) – The number of steps between the step_begin and step_end are called (Default=1).
Examples
>>> from mindspore.dataset import DSCallback >>> >>> class PrintInfo(DSCallback): ... def ds_epoch_end(self, ds_run_context): ... print(cb_params.cur_epoch_num) ... print(cb_params.cur_step_num) >>> >>> # dataset is an instance of Dataset object >>> dataset = dataset.map(operations=op, callbacks=PrintInfo())
- create_runtime_obj()[source]
Creates a runtime (C++) object from the callback methods defined by the user.
- Returns
_c_dataengine.PyDSCallback.
- ds_begin(ds_run_context)[source]
Called before the data pipeline is started.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.
- ds_epoch_begin(ds_run_context)[source]
Called before a new epoch is started.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.
- ds_epoch_end(ds_run_context)[source]
Called after an epoch is finished.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.
- ds_step_begin(ds_run_context)[source]
Called before each step start.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.
- ds_step_end(ds_run_context)[source]
Called after each step finished.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.