mindspore.dataset.dataloader.get_worker_info

View Source On Gitee
mindspore.dataset.dataloader.get_worker_info()[source]

Get the information about the current DataLoader worker process.

The information includes:

  • worker_id (int): The id of the current worker.

  • num_workers (int): The total number of workers.

  • seed (int): The random seed used by the current worker. This value is determined by the base seed generated by the main process and the worker id.

  • dataset (Dataset): The dataset object copied from the main process to the current worker.

If the current process is not a DataLoader worker process, return None.

Returns

Union[WorkerInfo, None], the information about the current DataLoader worker process.