diff --git a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py index 62bc8bfc4e..b8461bc084 100644 --- a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py +++ b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py @@ -50,6 +50,7 @@ ValuesView, ) +from ..utils.hooks import RemovableHandle try: import numpy as np @@ -2494,3 +2495,11 @@ def inner_compiler(gm_, example_inputs_): yield ctx else: yield + + +def invalid_removeable_handle(): + # need a subclass so weakref works + class Invalid(dict): # type: ignore[type-arg] + pass + + return RemovableHandle(Invalid())