MCPcopy Create free account
hub / github.com/pytorch/pytorch / _ScriptProfileTable

Class _ScriptProfileTable

torch/jit/_script.py:1609–1634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1607
1608
1609class _ScriptProfileTable:
1610 def __init__(self, cols: List[_ScriptProfileColumn], source_range: List[int]):
1611 self.cols = cols
1612 self.source_range = source_range
1613
1614 def dump_string(self):
1615 outputs: List[str] = []
1616 cells: List[Tuple[str, Dict[int, str]]] = []
1617 header_buffer = ""
1618 for col in self.cols:
1619 header, rows = col.materialize()
1620 header_buffer += header
1621 cells.append((header, dict(rows)))
1622
1623 outputs.append(header_buffer)
1624 outputs.append(pad("", len(header_buffer), 0, "="))
1625 for line in self.source_range:
1626 row_buffer = ""
1627 for header, rows in cells:
1628 cell = rows.get(line)
1629 if cell is None:
1630 row_buffer += pad("", len(header))
1631 else:
1632 row_buffer += cell
1633 outputs.append(row_buffer)
1634 return "\n".join(outputs)
1635
1636
1637class _ScriptProfile:

Callers 1

dump_stringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…