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

Method clean_batch_sizes

benchmarks/dynamo/runner.py:701–717  ·  view source on GitHub ↗
(self, frames)

Source from the content-addressed store, hash-verified

699 self.extract_df(metric, "performance")
700
701 def clean_batch_sizes(self, frames):
702 # Clean up batch sizes when its 0
703 if len(frames) == 1:
704 return frames
705 batch_sizes = frames[0]["batch_size"].to_list()
706 for frame in frames[1:]:
707 frame_batch_sizes = frame["batch_size"].to_list()
708 for idx, (batch_a, batch_b) in enumerate(
709 zip(batch_sizes, frame_batch_sizes)
710 ):
711 assert batch_a == batch_b or batch_a == 0 or batch_b == 0, print(
712 f"a={batch_a}, b={batch_b}"
713 )
714 batch_sizes[idx] = max(batch_a, batch_b)
715 for frame in frames:
716 frame["batch_size"] = batch_sizes
717 return frames
718
719 def extract_df(self, metric, testing):
720 for iter in itertools.product(self.suites, self.devices, self.dtypes):

Callers 1

extract_dfMethod · 0.95

Calls 2

maxFunction · 0.50
to_listMethod · 0.45

Tested by

no test coverage detected