---
title: thunder.dynamo.ThunderFXCompiledObject
description: A wrapper around the result of thunderfx() compilation.
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/thunder.dynamo.ThunderFXCompiledObject
---
# thunder.dynamo.ThunderFXCompiledObject {#thunder-dynamo-thunderfxcompiledobject}

### `class thunder.dynamo.ThunderFXCompiledObject(backend, func)` {#thunder.dynamo.ThunderFXCompiledObject}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/dynamo/compiler.py#L247-L306)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

A wrapper around the result of [`thunderfx()`](/docs/thunder/0.2.6/api-reference/thunder.dynamo.thunderfx.md#thunder.dynamo.thunderfx "thunder.dynamo.thunderfx") compilation.

This object wraps the function compiled with [`torch.compile()`](https://docs.pytorch.org/docs/stable/generated/torch.compile.html#torch.compile "(in PyTorch v2.15)") using Thunder as a backend (see [`ThunderCompiler`](/docs/thunder/0.2.6/api-reference/thunder.dynamo.ThunderCompiler.md#thunder.dynamo.ThunderCompiler "thunder.dynamo.ThunderCompiler")). It provides access to Thunder traces generated during execution, while maintaining the callable interface of the original compiled function.

Note: This is the return type of `thunderfx`, not [`thunder.jit()`](/docs/thunder/generated/thunder.jit#thunder.jit "thunder.jit").

Parameters:

*   **backend** ([_ThunderCompiler_](/docs/thunder/0.2.6/api-reference/thunder.dynamo.ThunderCompiler.md#thunder.dynamo.ThunderCompiler "thunder.dynamo.ThunderCompiler")) –
    
*   **func** (_Callable_) –
    

#### `__init__(backend, func)` {#thunder.dynamo.ThunderFXCompiledObject.__init__}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/dynamo/compiler.py#L258-L260)

Parameters:

*   **backend** ([_ThunderCompiler_](/docs/thunder/0.2.6/api-reference/thunder.dynamo.ThunderCompiler.md#thunder.dynamo.ThunderCompiler "thunder.dynamo.compiler.ThunderCompiler")) –
    
*   **func** ([_Callable_](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")) –
    

Methods

- [`__init__(backend, func)`](#thunder.dynamo.ThunderFXCompiledObject.__init__)

Attributes

- [`last_backward_traces`](#thunder.dynamo.ThunderFXCompiledObject.last_backward_traces) — Get the Thunder traces for all the backward subgraphs of a ThunderFX callable.
- [`last_traces`](#thunder.dynamo.ThunderFXCompiledObject.last_traces) — Get the Thunder traces for all the forward subgraphs of a ThunderFX callable.

#### `__call__(*args, **kwargs)` {#thunder.dynamo.ThunderFXCompiledObject.__call__}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/dynamo/compiler.py#L262-L263)

Call self as a function.

#### `property last_backward_traces: list[thunder.core.trace.TraceCtx]` {#thunder.dynamo.ThunderFXCompiledObject.last_backward_traces}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/thunder/dynamo.py)

Get the Thunder traces for all the backward subgraphs of a ThunderFX callable.

Note

The object must have been invoked before calling this function.

#### `property last_traces: list[thunder.core.trace.TraceCtx]` {#thunder.dynamo.ThunderFXCompiledObject.last_traces}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/thunder/dynamo.py)

Get the Thunder traces for all the forward subgraphs of a ThunderFX callable.

Note

The object must have been invoked before calling this function.

---

**Navigation**

- Parent: [API reference](/docs/thunder/0.2.6/api-reference.md)
