mindspore.nn.PipelineCell
- class mindspore.nn.PipelineCell(network, micro_size, stage_config=None, segment_config=None)[source]
Slice MiniBatch into finer-grained MicroBatch for use in pipeline-parallel training.
Note
micro_size must be greater or equal to pipeline stages.
The api will be deprecated, please use the api
mindspore.parallel.nn.Pipeline
instead.
- Parameters
network (Cell) – The target network to wrap.
micro_size (int) – MicroBatch size.
stage_config (dict, optional) – The stage configuration for each cell's execution in pipeline parallel. Default
None
.segment_config (dict, optional) – The segment configuration for each cell's execution in pipeline parallel. Default
None
.
- Supported Platforms:
Ascend
GPU
Examples
>>> import mindspore.nn as nn >>> # Define the network structure of LeNet5. Refer to >>> # https://gitee.com/mindspore/docs/blob/r2.7.0/docs/mindspore/code/lenet.py >>> net = LeNet5() >>> net = nn.PipelineCell(net, 4)