MCPcopy
hub / github.com/stas00/ml-engineering / analyse_variable

Method analyse_variable

debug/underflow_overflow.py:197–205  ·  view source on GitHub ↗
(self, var, ctx)

Source from the content-addressed store, hash-verified

195 # self.longest_module_name = max(len(v) for v in self.module_names.values())
196
197 def analyse_variable(self, var, ctx):
198 if torch.is_tensor(var):
199 self.expand_frame(get_abs_min_max(var, ctx))
200 if detect_overflow(var, ctx):
201 self.detected_overflow = True
202 elif var is None:
203 self.expand_frame(f"{'None':>17} {ctx}")
204 else:
205 self.expand_frame(f"{'not a tensor':>17} {ctx}")
206
207 def batch_start_frame(self):
208 self.expand_frame(f"\n\n{self.prefix} *** Starting batch number={self.batch_number} ***")

Callers 1

create_frameMethod · 0.95

Calls 3

expand_frameMethod · 0.95
get_abs_min_maxFunction · 0.85
detect_overflowFunction · 0.85

Tested by

no test coverage detected