code: def clock_cycles(m: int, n: int) -> Iterable[List[Tuple[int, int]]]:
      """Generates schedules for each clock cycle."""
      # m: number of micro-batches
      # n: number of partitions
      # i: index of micro-batch
      # j: index of partition
      # k: clock number
      #
      # k (i,j) (i,j) (i,j)
      # - ----- ----- -----
      # 0 (0,0)
      # 1 (1,0) (0,1)
      # 2 (2,0) (1,1) (0,2)
      # 3       (2,1) (1,2)
      # 4             (2,2)
      for k in range(m + n - 1):
          yield [
              (k - j, j)
              for j in range(max(1 + k - m, 0), min(1 + k, n))
          ]
  
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 a global function with example usage: clock_cycles(m, n) without return types