Skip to content

Commit 6920706

Browse files
committed
update
1 parent 39e06de commit 6920706

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

frontend/catalyst/autograph/ag_primitives.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,6 @@ def converted_call(fn, args, kwargs, caller_fn_scope=None, options=None):
548548
catalyst.mitigate_with_zne,
549549
)
550550

551-
# Build a map from module paths to decorator functions by inspecting the known wrappers
552-
decorator_map = {
553-
wrapper_fn.__module__: wrapper_fn
554-
for wrapper_fn in _known_wrapper_functions
555-
if hasattr(wrapper_fn, "__module__")
556-
}
557-
558551
# HOTFIX: pass through calls of known Catalyst wrapper functions
559552
if fn in _known_wrapper_functions:
560553
if not args:
@@ -614,7 +607,10 @@ def qnode_call_wrapper():
614607
# autograph conversion. We detect these wrappers and unwrap them to convert the
615608
# original function with autograph.
616609
if hasattr(fn, "__wrapped__") and hasattr(fn, "__module__"):
617-
if decorator := decorator_map.get(fn.__module__):
610+
# Find the decorator function
611+
if decorator := next(
612+
(f for f in _known_wrapper_functions if hasattr(f, "__module__")), None
613+
):
618614
original_fn = fn.__wrapped__
619615

620616
# Convert the original function with autograph

0 commit comments

Comments
 (0)