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
>>> class PrintInfo(DSCallback): >>> def ds_epoch_end(self, ds_run_context): >>> print(cb_params.cur_epoch_num) >>> print(cb_params.cur_step_num) >>> >>> data = data.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 n steps are started.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.
- ds_step_end(ds_run_context)[source]
Called after n steps are finished.
- Parameters
ds_run_context (RunContext) – Include some information of the pipeline.