set_buffer
Function
Sets data, data size, and whether to release memory for the input tensor object.
C++ Prototype
void SetBuffer(const void* buffer, size_t tensorbyteSize, bool tensorNeedRelease)
Python Prototype
set_buffer(tensor_data, tensor_need_release)
Parameters
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
tensor_data |
Mandatory |
Tensor data |
A valid object that complies with the Python buffer protocol |
tensor_need_release |
Mandatory |
Flag indicating whether to release the memory |
Valid bool type |
Usage Example
Set the data object for the input tensor and specify whether to release the memory (typically set to False). This ensures the tensor is released internally and does not require destruction with the inference tensor object.
1 2 | data = [0,1,2,3] infer_tensor.set_buffer(data, False) |
Parent topic: InferTensor