---
title: thunder.core.transforms.insert_inplace
description: 'Calls fn and record any symbols called into trc, starting at idx.'
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.core.transforms.insert_inplace
---
# thunder.core.transforms.insert_inplace {#thunder-core-transforms-insert-inplace}

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

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

Calls `fn` and record any symbols called into `trc`, starting at `idx`.

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)")) – Starting index of `trc.bound_symbols` 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`.
    
*   **fn** ([`Callable`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")\[\[\], [`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")\]) –
    
*   **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)")_\[__\[__\]__,_ [_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)
