---
title: thunder.dynamo.thunderfx
description: >-
  Compiles a callable (function or model) by using Thunder as the backend of
  torch.compile().
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/thunder.dynamo.thunderfx
---
# thunder.dynamo.thunderfx {#thunder-dynamo-thunderfx}

### `thunder.dynamo.thunderfx(fn, /, **kwargs)` {#thunder.dynamo.thunderfx}

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

Compiles a callable (function or model) by using Thunder as the backend of [`torch.compile()`](https://docs.pytorch.org/docs/stable/generated/torch.compile.html#torch.compile "(in PyTorch v2.15)").

Parameters:

*   **fn** ([`Callable`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")) – A [`Module`](https://docs.pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module "(in PyTorch v2.15)") or a function to compile.
    
*   **fn** ([_Callable_](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")) –
    

Keyword Arguments:

**\*\*kwargs** – a dictionary of options to pass to [`torch.compile()`](https://docs.pytorch.org/docs/stable/generated/torch.compile.html#torch.compile "(in PyTorch v2.15)") and [`thunder.jit()`](/docs/thunder/generated/thunder.jit#thunder.jit "thunder.jit").

Return type:

[`ThunderFXCompiledObject`](/docs/thunder/0.2.6/api-reference/thunder.dynamo.ThunderFXCompiledObject.md#thunder.dynamo.ThunderFXCompiledObject "thunder.dynamo.compiler.ThunderFXCompiledObject")

Returns:

The compiled callable

---

**Navigation**

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