GetLogMaxMinTmpSize

Function

Host-side API, which is used to obtain the minimum temporary space required by the Log API for computation. Sufficient physical space must be reserved for computation.

Prototype

1
void GetLogMaxMinTmpSize(const ge::Shape& srcShape, const uint32_t typeSize, const bool isReuseSource, uint32_t& maxValue, uint32_t& minValue)
1
void GetLog10MaxMinTmpSize(const ge::Shape& srcShape, const uint32_t typeSize, const bool isReuseSource, uint32_t& maxValue, uint32_t& minValue)
1
void GetLog2MaxMinTmpSize(const ge::Shape& srcShape, const uint32_t typeSize, const bool isReuseSource, uint32_t& maxValue, uint32_t& minValue)

Parameters

Table 1 API parameters

Parameter

Input/Output

Description

srcShape

Input

Input shape.

typeSize

Input

Size of the input data type, in bytes. For example, if the input data type is half, set this parameter to 2.

isReuseSource

Input

Whether to reuse the space of the source operand input, which must be the same as that of the Log API.

maxValue

Output

Maximum size of the temporary space required by Log computation. Any space exceeding this value will not be utilized by the API. Within the range between the minimum and maximum, as the temporary space increases, the API computing performance on the kernel becomes better to some extent. To achieve better performance, reserve or allocate the space based on the actual buffer usage. If the maximum space size is 0, no temporary space is required.

NOTE:

maxValue is for reference only and may be larger than the available space of the Unified Buffer. In this case, select a proper temporary space size based on the remaining space of the Unified Buffer.

minValue

Output

Minimum size of the temporary space required by Log computation. To ensure correct functions, the size of the temporary space to be reserved or allocated during API computation cannot be less than the value of this parameter. If the minimum space size is 0, no temporary space is required.

Returns

None

Restrictions

None

Example

For details about the complete calling example, see More Examples.

  • GetLogMaxMinTmpSize example:
    1
    2
    3
    4
    5
    6
    // The input shape is 1024. The operator input data is of the half type. The source operand cannot be modified.
    std::vector<int64_t> shape_vec = {1024};
    ge::Shape shape(shape_vec);
    uint32_t maxValue = 0;
    uint32_t minValue = 0;
    auto tmp_size = AscendC::GetLogMaxMinTmpSize(shape, 2, false, maxValue, minValue);
    
  • GetLog10MaxMinTmpSize example:
    1
    2
    3
    4
    5
    6
    // The input shape is 1024. The operator input data is of the half type. The source operand cannot be modified.
    std::vector<int64_t> shape_vec = {1024};
    ge::Shape shape(shape_vec);
    uint32_t maxValue = 0;
    uint32_t minValue = 0;
    auto tmp_size = AscendC::GetLog10MaxMinTmpSize(shape, 2, false, maxValue, minValue);
    
  • GetLog2MaxMinTmpSize example:
    1
    2
    3
    4
    5
    6
    // The input shape is 1024. The operator input data is of the half type. The source operand cannot be modified.
    std::vector<int64_t> shape_vec = {1024};
    ge::Shape shape(shape_vec);
    uint32_t maxValue = 0;
    uint32_t minValue = 0;
    auto tmp_size = AscendC::GetLog2MaxMinTmpSize(shape, 2, false, maxValue, minValue);