---
title: thunder.core.transforms.replace_inplace
description: Removes idx-th BoundSymbol of trc and replace it bsyms representing fn.
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.core.transforms.replace_inplace
---
# thunder.core.transforms.replace_inplace {#thunder-core-transforms-replace-inplace}

### `thunder.core.transforms.replace_inplace(trc, idx, fn)` {#thunder.core.transforms.replace_inplace}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/transforms.py#L322-L355)

Removes `idx`\-th [`BoundSymbol`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol") of `trc` and replace it `bsyms` representing `fn`.

Parameters:

*   **trc** ([`TraceCtx`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.trace.TraceCtx.md#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")) – Trace to insert [`BoundSymbol`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol")s representing `fn`.
    
*   **idx** ([`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")) – Index of [`BoundSymbol`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol") of `trc`.
    
*   **fn** ([`Callable`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")\[\[[`BoundSymbol`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol")\], [`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")\]) – Callable to bake into `trc`, instead of `idx`\-th [`BoundSymbol`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol").
    
*   **trc** ([_TraceCtx_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.trace.TraceCtx.md#thunder.core.trace.TraceCtx "thunder.core.trace.TraceCtx")) –
    
*   **idx** ([_int_](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")) –
    
*   **fn** ([_Callable_](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")_\[__\[_[_BoundSymbol_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.symbol.BoundSymbol.md#thunder.core.symbol.BoundSymbol "thunder.core.symbol.BoundSymbol")_\]__,_ [_Any_](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")_\]_) –
    

Return type:

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

Note

This operation is inplace. It will modify the given `trc`’s [`bound_symbols`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.trace.TraceCtx.md#thunder.core.trace.TraceCtx.bound_symbols "thunder.core.trace.TraceCtx.bound_symbols").

Note

Because this operation is explicitly inplace, it will disregard whether or not `mark_complete()` has been called on `trc` already.

---

**Navigation**

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