MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / activate

Method activate

tools/Polygraphy/polygraphy/backend/base/runner.py:74–96  ·  view source on GitHub ↗

Activate the runner for inference. For example, this may involve allocating CPU or GPU memory. Generally, you should use a context manager instead of manually activating and deactivating. For example: :: with RunnerType(...) as runner: r

(self)

Source from the content-addressed store, hash-verified

72 pass
73
74 def activate(self):
75 """
76 Activate the runner for inference. For example, this may involve allocating CPU or GPU memory.
77
78 Generally, you should use a context manager instead of manually activating and deactivating.
79 For example:
80 ::
81
82 with RunnerType(...) as runner:
83 runner.infer(...)
84 """
85 if self.is_active:
86 G_LOGGER.warning(
87 f"{self.name:35} | Already active; will not activate again. "
88 "If you really want to activate this runner again, call activate_impl() directly"
89 )
90 return
91
92 if config.INTERNAL_CORRECTNESS_CHECKS:
93 self._pre_activate_runner_state = copy.copy(vars(self))
94
95 self.activate_impl()
96 self.is_active = True
97
98 def get_input_metadata_impl(self):
99 """

Callers 2

__enter__Method · 0.95
checkFunction · 0.45

Calls 3

activate_implMethod · 0.95
warningMethod · 0.45
copyMethod · 0.45

Tested by 1

checkFunction · 0.36