AllocTensorMsgWithAlign

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Function Description

Allocates FlowMsg of the tensor type based on the shape, data type, and alignment size. The difference between this function and AllocTensorMsg is that AllocTensorMsg is 64-byte aligned by default. This function can be used to specify the alignment size, to facilitate performance optimization.

Prototype

1
std::shared_ptr<FlowMsg> AllocTensorMsgWithAlign(const std::vector<int64_t> &shape, TensorDataType dataType, uint32_t align)

Command-Line Options

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

Allocated tensor pointer.

Troubleshooting

If no tensor pointer can be allocated, NULL is returned.

Constraints

None