# helia_aot.memory.defines.TensorLifetime

## helia_aot.memory.defines.TensorLifetime

`class` · `python`

```python
TensorLifetime()
```

Tensor operator lifetime.

Provisional: importable, but outside the compatibility promise; a minor release can change or remove it.

Source: `helia_aot/memory/defines.py:142`

### helia_aot.memory.defines.TensorLifetime.tensor_id

`attribute` · `python`

```python
tensor_id: TensorId = Field(..., description='Unique identifier for the tensor')
```

Unique identifier for the tensor

Source: `helia_aot/memory/defines.py:152`

### helia_aot.memory.defines.TensorLifetime.start_op

`attribute` · `python`

```python
start_op: int = Field(..., description='Index of the first operator that uses/defines it')
```

Index of the first operator that uses/defines it

Source: `helia_aot/memory/defines.py:153`

### helia_aot.memory.defines.TensorLifetime.end_op

`attribute` · `python`

```python
end_op: int = Field(..., description='Index of the last operator that uses it')
```

Index of the last operator that uses it

Source: `helia_aot/memory/defines.py:154`

### helia_aot.memory.defines.TensorLifetime.add_op

`method` · `python`

```python
add_op(op_idx: int)
```

Add an operator index to the lifetime.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| op_idx | int | Required | Operator index to add |

Source: `helia_aot/memory/defines.py:156`

### helia_aot.memory.defines.TensorLifetime.merge

`method` · `python`

```python
merge(other: TensorLifetime)
```

Merge another lifetime into this one.

This updates the start and end operators to encompass both lifetimes.
Useful when tensors have aliases.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| other | TensorLifetime | Required | Another tensor lifetime to merge |

Source: `helia_aot/memory/defines.py:165`
