class_docstr: The pipeline parallelism for Pipe.
class_docstr_tok: ["The","pipeline","parallelism","for","Pipe","."]
docstr: Copies micro-batches after computation for the previous
  micro-batches.
docstr_tok: ["Copies","micro-batches","after","computation","for","the","previous","micro-batches","."]
code: def fence(
      self,
      batches: List[Batch],
      schedule: List[Tuple[int, int]],
      skip_trackers: List[SkipTrackerThroughPotals],
  ) -> None:
      """Copies micro-batches after computation for the previous
      micro-batches.
      """
      copy_streams = self.copy_streams
      skip_layout = self.skip_layout
  
      for i, j in schedule:
          # Ensure that batches[i-1] is executed after batches[i] in
          # backpropagation by an explicit dependency.
          if i != 0 and j != 0:
              depend(batches[i - 1], batches[i])
  
          next_stream = copy_streams[j][i]
  
          for prev_j, ns, name in skip_layout.copy_policy(j):
              prev_stream = copy_streams[prev_j][i]
              skip_trackers[i].copy(
                  batches[i], prev_stream, next_stream, ns, name
              )
  
          if j != 0:
              prev_stream = copy_streams[j - 1][i]
              copy(batches[i], prev_stream, next_stream)
  
imports: from queue import Queue
  from types import TracebackType
  from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Type, Union, cast
  import torch
  from torch import Tensor, nn
  from torch.autograd.profiler import record_function
  from .checkpoint import Checkpointing
  from .copy import Copy, Wait
  from .dependency import fork, join
  from .microbatch import Batch
  from .skip.layout import SkipLayout
  from .skip.tracker import SkipTrackerThroughPotals, use_skip_tracker
  from .stream import AbstractStream, current_stream, use_device
  from .worker import Task, create_workers, join_workers
label_desc: Use image node_id 4 for calling the Pipeline obj's underlying member method code with example usage: obj.fence(batches, schedule, skip_trackers) without return types