class_docstr: A class for visualizing execution timelines of TensorFlow steps.
class_docstr_tok: ["A","class","for","visualizing","execution","timelines","of","TensorFlow","steps","."]
docstr: Assigns non-overlapping lanes for the activities on each device.
docstr_tok: ["Assigns","non-overlapping","lanes","for","the","activities","on","each","device","."]
code: def _assign_lanes(self) -> None:
      """Assigns non-overlapping lanes for the activities on each device."""
      for device_stats in self._step_stats.dev_stats:
          # TODO(pbar): Genuine thread IDs in step_stats_pb2.NodeExecStats
          # might be helpful.
          lanes = [0]
          for ns in device_stats.node_stats:
              l = -1
              for i, lts in enumerate(lanes):
                  if ns.all_start_micros > lts:
                      l = i
                      lanes[l] = (
                          ns.all_start_micros + ns.all_end_rel_micros
                      )
                      break
              if l < 0:
                  l = len(lanes)
                  lanes.append(
                      ns.all_start_micros + ns.all_end_rel_micros
                  )
              ns.thread_id = l
  
imports: import collections
  import copy
  import json
  import re
  from typing import Any, Dict, List, Optional, Tuple, Union
  from tensorflow.core.framework import step_stats_pb2
  from tensorflow.python.platform import build_info
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 6 for calling the Timeline obj's underlying member method code with example usage: obj._assign_lanes() without return types