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

Method __call__

lightx2v/utils/profiler.py:114–130  ·  view source on GitHub ↗
(self, func)

Source from the content-addressed store, hash-verified

112 self._memory_profile_active = True
113 stack.append(self)
114
115 def _end_memory_profile(self):
116 if not self._memory_profile_active:
117 return ""
118
119 stack = _get_memory_profile_stack()
120 try:
121 peak_allocated, peak_reserved = self._read_memory_peak()
122 for context in stack:
123 context._record_memory_peak(peak_allocated, peak_reserved)
124 torch_device_module.reset_peak_memory_stats()
125 except (RuntimeError, NotImplementedError):
126 pass
127 finally:
128 if stack and stack[-1] is self:
129 stack.pop()
130 elif self in stack:
131 stack.remove(self)
132 self._memory_profile_active = False
133

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected