Skip to content

Commit

Permalink
Improve support for backwards hooks (#119525)
Browse files Browse the repository at this point in the history
Summary:
X-link: pytorch/pytorch#119525
Approved by: https://github.com/yanboliang, https://github.com/anijain2305

Reviewed By: huydhn

Differential Revision: D53634801

Pulled By: jansel

fbshipit-source-id: d18819e331cd408f099ef5101cdbe9bc3d1ae172
  • Loading branch information
jansel authored and facebook-github-bot committed Feb 12, 2024
1 parent 62f4e9c commit 542c876
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
ValuesView,
)

from ..utils.hooks import RemovableHandle

try:
import numpy as np
Expand Down Expand Up @@ -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())

0 comments on commit 542c876

Please sign in to comment.