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)
| 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 | """ |