Skip to content

Commit 8a1b242

Browse files
authored
Use capture autograph if capture is enabled (#1960)
1 parent 0f32a73 commit 8a1b242

File tree

3 files changed

+95
-16
lines changed

3 files changed

+95
-16
lines changed

doc/releases/changelog-dev.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757

5858
<h3>Internal changes ⚙️</h3>
5959

60+
* When capture is enabled, `qjit(autograph=True)` will use capture autograph instead of catalyst autograph.
61+
[(#1960)](https://github.com/PennyLaneAI/catalyst/pull/1960)
62+
6063
* QJitDevice helper `extract_backend_info` removed its redundant `capabilities` argument.
6164
[(#1956)](https://github.com/PennyLaneAI/catalyst/pull/1956)
6265

frontend/catalyst/jit.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,12 @@ def jit_compile(self, args, **kwargs):
692692
def pre_compilation(self):
693693
"""Perform pre-processing tasks on the Python function, such as AST transformations."""
694694
if self.compile_options.autograph:
695+
if qml.capture.enabled():
696+
if self.compile_options.autograph_include:
697+
raise NotImplementedError(
698+
"capture autograph does not yet support autograph_include."
699+
)
700+
return qml.capture.run_autograph(self.original_function)
695701
return run_autograph(self.original_function, *self.compile_options.autograph_include)
696702

697703
return self.original_function

0 commit comments

Comments
 (0)