MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / trace_normal

Method trace_normal

imperative/python/megengine/jit/tracing.py:352–377  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

350 return self.trace_without_host(*args, **kwargs)
351
352 def trace_normal(self, *args, **kwargs):
353 global active_trace
354 symbolic_shape = None
355 outputs = None
356 try:
357 active_trace = self
358 self._trace.enter()
359 if self._capture_as_const:
360 self._process_inputs(*args, **kwargs)
361 symbolic_shape = set_symbolic_shape(self._symbolic_shape)
362 outputs = self.__wrapped__(*args, **kwargs)
363 finally:
364 handling_exc = sys.exc_info() != (None,) * 3
365 active_trace = None
366 if symbolic_shape is not None:
367 symbolic_shape = set_symbolic_shape(symbolic_shape)
368 assert symbolic_shape == self._symbolic_shape
369 if self._capture_as_const and (outputs is not None):
370 self._process_outputs(outputs)
371 try:
372 # may raise TraceError
373 self._trace.exit()
374 except TraceError:
375 if not handling_exc:
376 raise
377 return outputs
378
379 def trace_without_host(self, *args, **kwargs):
380 from ..traced_module.pytree import tree_flatten, SUPPORTED_LEAF_CLS

Callers 1

__call__Method · 0.95

Calls 5

_process_inputsMethod · 0.95
_process_outputsMethod · 0.95
set_symbolic_shapeFunction · 0.50
enterMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected