Updated on 2022-03-13 GMT+08:00

AISimpleTensor::SetBuffer

Sets the tensor data address.

Syntax

void SetBuffer(void *data, const int32_t size, bool isown=false);

Parameter Description

Parameter

Description

Value Range

data

Data address

-

size

Data length

NOTE:

The unit is byte. The value of size must be the same as the actual data size.

-

isown

Whether the tensor frees the memory of the data address after the tensor life cycle expires.

  • false (default): You can perform the free operation after the tensor life cycle expires.
  • true: After the tensor life cycle expires, the tensor frees the memory. Do not perform the free operation manually in this case. Otherwise, the memory is repeatedly freed.

-

Return Value

None