Skip to main content

Python class

CompilationTimer

CompilationTimer

class max.pipelines.lib.CompilationTimer(name)

source

Bases: object

Timer for logging graph build and compilation phases.

Use as a context manager. Starts timing on entry. Call mark_build_complete() after graph building; timings are logged on exit.

Parameters:

name (str) – The name to use in log messages (e.g., “model”, “vision model”).

Example:

>>> with CompilationTimer("model") as timer:
...     graph = self._build_graph(self.weights, self.adapter)
...     timer.mark_build_complete()
...     model = session.load(graph, weights_registry=self.state_dict)

mark_build_complete()

mark_build_complete()

source

Marks the end of the build phase and logs build time.

Return type:

None