GetShapeInfo

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas training product

Function Usage

Obtains the shape information of a LocalTensor. Note: The shape information does not have a default value. This API can be called to obtain the correct shape information only after the shape information is set by using SetShapeInfo.

Prototype

1
__aicore__ inline ShapeInfo GetShapeInfo() const

Parameters

None

Returns

Shape information of the LocalTensor, which is of the ShapeInfo structure type.

Restrictions

None

Examples

1
2
3
4
5
6
7
// Example: Obtain ShapeInfo of a tensor.
AscendC::ShapeInfo maxShapeInfo = maxUb.GetShapeInfo();
uint32_t orgShape0 = maxShapeInfo.originalShape[0];
uint32_t orgShape1 = maxShapeInfo.originalShape[1];
uint32_t orgShape2 = maxShapeInfo.originalShape[2];
uint32_t orgShape3 = maxShapeInfo.originalShape[3];
uint32_t shape2 = maxShapeInfo.shape[2];