---
title: thunder.core.proxies.TensorProxy
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.core.proxies.TensorProxy
---
# thunder.core.proxies.TensorProxy {#thunder-core-proxies-tensorproxy}

### `class thunder.core.proxies.TensorProxy(name=None, *, like=None, shape=None, device=None, dtype=None, requires_grad=False, grad=None, prefix=None, distparallel_type=None, history=None, tags=None, thunder_fsdp_padding_size=None)` {#thunder.core.proxies.TensorProxy}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/proxies.py#L1439-L1916)

Bases: `Proxy`, [`TensorProxyInterface`](/docs/thunder/0.2.6/api-reference/generated/thunder.core.baseutils.TensorProxyInterface.md#thunder.core.baseutils.TensorProxyInterface "thunder.core.baseutils.TensorProxyInterface")

Parameters:

*   **name** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_) –
    
*   **like** ([_TensorProxy_](#thunder.core.proxies.TensorProxy "thunder.core.proxies.TensorProxy") _|_ [_FutureTensorProxy_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.proxies.FutureTensorProxy.md#thunder.core.proxies.FutureTensorProxy "thunder.core.proxies.FutureTensorProxy") _|_ _None_) –
    
*   **shape** (_ShapeLike_ _|_ _None_) –
    
*   **device** ([_devices.Device_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.devices.Device.md#thunder.core.devices.Device "thunder.core.devices.Device") _|_ _None_) –
    
*   **dtype** ([_dtypes.dtype_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.dtypes.dtype.md#thunder.core.dtypes.dtype "thunder.core.dtypes.dtype") _|_ _None_) –
    
*   **requires\_grad** ([_bool_](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) –
    
*   **grad** ([_TensorProxy_](#thunder.core.proxies.TensorProxy "thunder.core.proxies.TensorProxy") _|_ _None_) –
    
*   **prefix** (_None_ _|_ [_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) –
    
*   **distparallel\_type** (_DistParallelType_ _|_ _None_) –
    
*   **history** (_None_ _|_ [_tuple_](https://docs.python.org/3/builtins/stdtypes.html#tuple "(in Python v3.15)")) –
    
*   **tags** ([_set_](https://docs.python.org/3/builtins/stdtypes.html#set "(in Python v3.15)") _|_ _None_) –
    
*   **thunder\_fsdp\_padding\_size** ([_int_](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") _|_ _None_) –
    

#### `__init__(name=None, *, like=None, shape=None, device=None, dtype=None, requires_grad=False, grad=None, prefix=None, distparallel_type=None, history=None, tags=None, thunder_fsdp_padding_size=None)` {#thunder.core.proxies.TensorProxy.__init__}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/proxies.py#L1442-L1480)

Parameters:

*   **name** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")_\]_) –
    
*   **like** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_Union_](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.15)")_\[_[_TensorProxy_](#thunder.core.proxies.TensorProxy "thunder.core.proxies.TensorProxy")_,_ [_FutureTensorProxy_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.proxies.FutureTensorProxy.md#thunder.core.proxies.FutureTensorProxy "thunder.core.proxies.FutureTensorProxy")_\]__\]_) –
    
*   **shape** ([_Union_](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.15)")_\[__None__,_ [_Sequence_](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "(in Python v3.15)")_\[_[_int_](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")_\]__\]_) –
    
*   **device** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_Device_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.devices.Device.md#thunder.core.devices.Device "thunder.core.devices.Device")_\]_) –
    
*   **dtype** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_dtype_](/docs/thunder/0.2.6/api-reference/generated/thunder.core.dtypes.dtype.md#thunder.core.dtypes.dtype "thunder.core.dtypes.dtype")_\]_) –
    
*   **requires\_grad** ([_bool_](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) –
    
*   **grad** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_TensorProxy_](#thunder.core.proxies.TensorProxy "thunder.core.proxies.TensorProxy")_\]_) –
    
*   **prefix** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")_\]_) –
    
*   **distparallel\_type** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[__DistParallelType__\]_) –
    
*   **history** ([_Union_](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.15)")_\[__None__,_ [_tuple_](https://docs.python.org/3/builtins/stdtypes.html#tuple "(in Python v3.15)")_\]_) –
    
*   **tags** ([_Optional_](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")_\[_[_set_](https://docs.python.org/3/builtins/stdtypes.html#set "(in Python v3.15)")_\]_) –
    
*   **thunder\_fsdp\_padding\_size** ([_Union_](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.15)")_\[__None__,_ [_int_](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")_\]_) –
    

Methods

- [`__init__([name, like, shape, device, dtype, ...])`](#thunder.core.proxies.TensorProxy.__init__)
- `float()`
- `get_default_attr(attr, /)` — rtype:Optional[Any]
- `get_default_prefix()` — rtype:str
- [`replace(**changes)`](#thunder.core.proxies.TensorProxy.replace) — Return a copy of the TensorProxy object with new values for the specified fields as given to the constructor as arguments.
- `replace_name([name, disambiguate])` — Return a copy of this proxy with the given name.
- `type_string()`

Attributes

- `T`
- `device`
- `distparallel_type`
- `dtype`
- `grad`
- `imag`
- `mT`
- `name`
- `ndim`
- `prefix` — Return the prefix for this proxy instance.
- `real`
- `requires_grad`
- `shape`
- `tags`
- `thunder_fsdp_padding_size`
- `true_dtype`

#### `replace(**changes)` {#thunder.core.proxies.TensorProxy.replace}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/proxies.py#L1536-L1578)

Return a copy of the TensorProxy object with new values for the specified fields as given to the constructor as arguments. Valid keyword arguments are `name`, `history`, `shape`, `dtype`, `device`, `requires_grad`, `distparallel_type`, `thunder_fsdp_padding_size`. `like` is also a valid keyword and will take metadata from the tensor proxy argument in preference to the old values but overridable by keyword arguments. Note that the copy will use the current (environment) tracectx.

---

**Navigation**

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