class_docstr: This class processes a single partition of the pipeline.
  Args:
      module_rref: RRef to the nn.Module for this partition. It should be on the local rpc worker.
      device: The device that holds the module.
      num_inputs: Numer of inputs to the module
      num_outputs: Number of outputs of the module. If the module output is not a tuple (and it is a
          single tensor), num_outputs should be None.
      rank: The rank of the partition
      chunks: Number of micor-batches in a mini-batch
      checkpoint_stop:: Checkpointing is done only for the first checkpoint_stop chunks of a mini-batch.
class_docstr_tok: ["This","class","processes","a","single","partition","of","the","pipeline",".","Args",":","module_rref",":","RRef","to","the","nn.Module","for","this","partition",".","It","should","be","on","the","local","rpc","worker",".","device",":","The","device","that","holds","the","module",".","num_inputs",":","Numer","of","inputs","to","the","module","num_outputs",":","Number","of","outputs","of","the","module",".","If","the","module","output","is","not","a","tuple","(","and","it","is","a","single","tensor",")",",","num_outputs","should","be","None",".","rank",":","The","rank","of","the","partition","chunks",":","Number","of","micor-batches","in","a","mini-batch","checkpoint_stop",":",":","Checkpointing","is","done","only","for","the","first","checkpoint_stop","chunks","of","a","mini-batch","."]
docstr: Runs pipeline parallelism. It modifies the given batches in place.
docstr_tok: ["Runs","pipeline","parallelism",".","It","modifies","the","given","batches","in","place","."]
code: def run(self, pipeline_record: DistributedPipelineRecord) -> None:
      """Runs pipeline parallelism. It modifies the given batches in place."""
      m = len(pipeline_record.batches)
  
      self.stream = current_stream(self.device)
  
      for chunk in range(m):
          with record_function("feed"):
              pipeline_record.wait_for(chunk)
          pipeline_record.fence(chunk)
          self.compute(pipeline_record, chunk)
          with use_stream(self.stream):
              pipeline_record.forward_results(chunk)
  
imports: from threading import Condition
  from types import TracebackType
  from typing import Dict, List, Optional, Tuple, Type, Union, cast
  import torch
  from torch import Tensor
  from torch.autograd.profiler import record_function
  from torch.distributed import rpc
  from fairscale.nn.pipe import microbatch
  from fairscale.nn.pipe.checkpoint import Checkpointing, TensorOrTensors
  from fairscale.nn.pipe.dependency import fork, join
  from fairscale.nn.pipe.microbatch import Batch
  from fairscale.nn.pipe.stream import as_cuda, current_stream, is_cuda, use_device, use_stream
  from fairscale.nn.pipe.worker import Task, create_workers
  from .data import DataConsumer
label_desc: Use image node_id 5 for calling the PartitionHandler obj's underlying member method code with example usage: obj.run(pipeline_record) without return types