mindspore.dataset.config.set_sending_batches

View Source On Gitee
mindspore.dataset.config.set_sending_batches(batch_num)

Set the upper limit on the number of batches of data that the Host can send to the Device.

Can be used to implement customized data sending control logic to solve the problem of Device out of memory. In each epoch, when the actual number of batches sent to the Device reaches this value, the Host will stop continuing to send until the user increases this upper limit again through this interface.

Currently, it is only supported when training in sink mode with Ascend backend, which can be enabled via the mindspore.train.Model.train interface.

Parameters

batch_num (int) – The upper limit on the number of batches of data that the Host can send to the Device. 0 indicates that there is no upper limit for sending.

Raises

TypeError – If batch_num is not of type int.

Examples

>>> # Set a new global configuration value for the sending batches
>>> import mindspore.dataset as ds
>>> ds.config.set_sending_batches(10)