GetShapeInfo
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the shape information of the GlobalTensor. 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
Returns shape information of the GlobalTensor, which is of the ShapeInfo type.
Restrictions
None
Examples
1 2 3 4 5 6 7 8 9 | // Example: Obtain ShapeInfo of a tensor, which has been set by SetShapeInfo. AscendC::ShapeInfo maxShapeInfo = tglobal.GetShapeInfo(); // Obtain the value of each dimension of the original shape. uint32_t orgShape0 = maxShapeInfo.originalShape[0]; uint32_t orgShape1 = maxShapeInfo.originalShape[1]; uint32_t orgShape2 = maxShapeInfo.originalShape[2]; uint32_t orgShape3 = maxShapeInfo.originalShape[3]; // Obtain the 2D value of the current shape. uint32_t shape2 = maxShapeInfo.shape[2] |
Parent topic: GlobalTensor