# linearmemoryplanner

Sequential buffer placement without reuse.

## tflite::LinearMemoryPlanner

`class` · `cpp`

```cpp
class LinearMemoryPlanner : public tflite::MicroMemoryPlanner
```

The simplest possible memory planner that just lays out all buffers at increasing offsets without trying to reuse memory.

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:26`

### tflite::LinearMemoryPlanner::LinearMemoryPlanner

`method` · `cpp`

```cpp
tflite::LinearMemoryPlanner::LinearMemoryPlanner()
```

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:28`

### tflite::LinearMemoryPlanner::~LinearMemoryPlanner

`method` · `cpp`

```cpp
tflite::LinearMemoryPlanner::~LinearMemoryPlanner()
```

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:29`

### tflite::LinearMemoryPlanner::AddBuffer

`method` · `cpp`

```cpp
TfLiteStatus tflite::LinearMemoryPlanner::AddBuffer(int size, int first_time_used, int last_time_used)
```

Pass information about a buffer's size and lifetime to the layout algorithm. The order this is called implicitly assigns an index to the result, so the buffer information that's passed into the N-th call of this method will be used as the buffer_index argument to `GetOffsetForBuffer()`.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| size | int | Required |  |
| first_time_used | int | Required |  |
| last_time_used | int | Required |  |

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:31`

### tflite::LinearMemoryPlanner::GetMaximumMemorySize

`method` · `cpp`

```cpp
size_t tflite::LinearMemoryPlanner::GetMaximumMemorySize()
```

The largest contiguous block of memory that's needed to hold the layout.

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:34`

### tflite::LinearMemoryPlanner::GetBufferCount

`method` · `cpp`

```cpp
int tflite::LinearMemoryPlanner::GetBufferCount()
```

How many buffers have been added to the planner.

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:35`

### tflite::LinearMemoryPlanner::GetOffsetForBuffer

`method` · `cpp`

```cpp
TfLiteStatus tflite::LinearMemoryPlanner::GetOffsetForBuffer(int buffer_index, int *offset)
```

Calculated layout offset for the N-th buffer added to the planner.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| buffer_index | int | Required |  |
| offset | int * | Required |  |

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:36`

### tflite::LinearMemoryPlanner::preserves_all_tensors

`method` · `cpp`

```cpp
bool tflite::LinearMemoryPlanner::preserves_all_tensors() const
```

Returns True because the `LinearMemoryPlanner` preserves all tensors after invocation.

Source: `tensorflow/lite/micro/memory_planner/linear_memory_planner.h:40`
