Defines the ShapeInfo structure.
struct ShapeInfo {
public:
__aicore__ inline ShapeInfo();
__aicore__ inline ShapeInfo(const uint8_t inputShapeDim, const uint32_t inputShape[],
const uint8_t inputOriginalShapeDim, const uint32_t inputOriginalShape[], const DataFormat inputFormat);
__aicore__ inline ShapeInfo(const uint8_t inputShapeDim, const uint32_t inputShape[], const DataFormat inputFormat);
__aicore__ inline ShapeInfo(const uint8_t inputShapeDim, const uint32_t inputShape[]);
uint8_t shapeDim;
uint8_t originalShapeDim;
uint32_t shape[K_MAX_DIM];
uint32_t originalShape[K_MAX_DIM];
DataFormat dataFormat;
}; Obtains the product of all dimensions in a shape.
__aicore__ inline int GetShapeSize(const ShapeInfo& shapeInfo)
Table 1 ShapeInfo structure parameters
| Parameter | Type | Description |
|---|---|---|
| shapeDim | uint8_t | Current shape dimension. |
| shape | uint32_t | Current shape. |
| originalShapeDim | uint8_t | Original shape dimension. |
| originalShape | uint32_t | Original shape. |
| dataFormat | DataFormat | Data layout format. The value is 0 for NCHW and 1 for NHWC. - NCHW: Data is arranged by NCHW. - NHWC: Data is arranged by NHWC. |
Table 2 GetShapeSize parameter description
| Function Name | Input Parameter | Description |
|---|---|---|
| shapeInfo | Shape information of a tensor. | Stores the shape information of LocalTensor or GlobalTensor. |