Makes :func:`is_recomputing` return :data:`True` within a context.
()
| 237 | |
| 238 | @contextmanager |
| 239 | def enable_recomputing() -> Generator[None, None, None]: |
| 240 | """Makes :func:`is_recomputing` return :data:`True` within a context.""" |
| 241 | orig = thread_local.is_recomputing |
| 242 | thread_local.is_recomputing = True |
| 243 | try: |
| 244 | yield |
| 245 | finally: |
| 246 | thread_local.is_recomputing = orig |
| 247 | |
| 248 | |
| 249 | def is_checkpointing() -> bool: |