GetReduceProdMaxMinTmpSize
Function Usage
To perform ReduceProd computation on the kernel, you need to reserve or allocate the temporary space. This API is used to obtain the maximum and minimum temporary space sizes to be reserved or allocated on the host. You can select a proper size within this range as the tiling parameter and pass it to the kernel.
- To ensure correct function, the temporary space to be reserved or allocated cannot be less than the minimum temporary space.
- Within the range between the minimum and maximum, as the temporary space increases, the API computing performance in the kernel can be optimized to some extent. To achieve better performance, reserve or allocate the space based on the actual buffer usage. The maximum temporary space of this API is currently equal to the minimum temporary space.
Prototype
1
|
void GetReduceProdMaxMinTmpSize(const ge::Shape& srcShape, const ge::DataType dataType, ReducePattern pattern, bool isSrcInnerPad, bool isReuseSource, uint32_t& maxValue, uint32_t& minValue) |
Parameters
Returns
None
Constraints
None
Examples
For a complete call example, see More Examples.
1 2 3 4 5 |
// The input shape is a 16 × 32 matrix. The data type of the operator input is float. The default value false is passed to isReuseSource. uint32_t maxSize; uint32_t minSize; auto shape = ge::Shape({ 16, 32 }); AscendC::GetReduceProdMaxMinTmpSize(shape, ge::DataType::DT_FLOAT, AscendC::ReducePattern::AR, true, false, maxSize, minSize); |
Parent topic: ReduceProd APIs