AllocTensorMsgWithAlign
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
Function Description
Allocates FlowMsg of the tensor type based on the shape, data type, and alignment size. Its difference from AllocTensorMsg lies in that AllocTensorMsg allocates tensors with 64-byte alignment by default, while this function allows custom alignment size for performance tuning.
Prototype
1 | std::shared_ptr<FlowMsg> AllocTensorMsgWithAlign(const std::vector<int64_t> &shape, TensorDataType dataType, uint32_t align) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
shape |
Input |
Shape of a tensor. |
dataType |
Input |
Data type of a tensor. |
align |
Input |
Alignment size for the allocated memory address. The value range is [32, 64, 128, 256, 512, 1024]. |
Returns
Pointer to the allocated tensor.
Exception Handling
NULL is returned if the tensor allocation fails.
Constraints
None