MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / __aexit__

Method __aexit__

lightx2v/utils/profiler.py:98–112  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

96 try:
97 if stack:
98 peak_allocated, peak_reserved = self._read_memory_peak()
99 for context in stack:
100 context._record_memory_peak(peak_allocated, peak_reserved)
101 reset_peak_memory_stats()
102 except (RuntimeError, NotImplementedError):
103 return
104
105 memory_allocated = getattr(torch_device_module, "memory_allocated", None)
106 try:
107 self.start_memory_allocated = memory_allocated() if memory_allocated is not None else 0
108 except (RuntimeError, NotImplementedError):
109 self.start_memory_allocated = 0
110 self.peak_memory_allocated = 0
111 self.peak_memory_reserved = None
112 self._memory_profile_active = True
113 stack.append(self)
114
115 def _end_memory_profile(self):

Callers

nothing calls this directly

Calls 3

_get_excluded_time_stackFunction · 0.85
popMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected