> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::utils::TensorTransmitCache

> Persistent cache for output message and tensor allocations used by the cached variant of transmit_data_per_model.

Persistent cache for output message and tensor allocations used by the cached variant of transmit\_data\_per\_model.

Holds a reusable GXF entity and per-tensor metadata to minimise per-frame overhead. Three cases are handled each frame:

1. First use or buffer too small: full reshape (reallocate + update shape).
2. Incoming fits in existing allocation but dims changed: wrapMemory to update shape metadata only — no free/alloc of the underlying buffer.
3. Same dims as last frame: fast path, no tensor mutation at all.

```cpp showLineNumbers={false}
#include <holoscan/utils/holoinfer_utils.hpp>
```

---

## Member variables

| Name               | Type                                              | Description                                                                                                                                                                |
| ------------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `out_message`      | `nvidia::gxf::Expected< nvidia::gxf::Entity >`    | Persistent output entity. Invalid until the first call to transmit\_data\_per\_model.                                                                                      |
| `allocated_sizes`  | `std::map< std::string, size_t >`                 | Maximum element count that has been allocated for each output tensor.                                                                                                      |
| `last_dims`        | `std::map< std::string, std::vector< int64_t > >` | Dimension vector from the most recent frame for each output tensor, used to detect shape changes that require a wrapMemory call even when the element count has not grown. |
| `resolved_outputs` | `std::vector< ResolvedOutput >`                   |                                                                                                                                                                            |
| `resolved_valid`   | `bool`                                            | True once `resolved_outputs` has been populated by the first call and matches `out_tensors`.                                                                               |

---

## Inner classes

### ResolvedOutput

```cpp showLineNumbers={false}
struct holoscan::utils::TensorTransmitCache::ResolvedOutput
```

| Name           | Type                            | Description |
| -------------- | ------------------------------- | ----------- |
| `key_name`     | `std::string`                   |             |
| `tensor_index` | `unsigned int`                  |             |
| `data_buffer`  | `HoloInfer::DataBuffer *`       |             |
| `dtype`        | `HoloInfer::holoinfer_datatype` |             |