Overview

NumericLimits is a tool class used to query attributes such as the maximum and minimum values of a specified data type.

The data type is specified by the template parameter T. The prototype definition is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
template <typename T>
struct NumericLimits {
    // Scalar API, which returns a scalar.
    constexpr __aicore__ static inline T Max();
    constexpr __aicore__ static inline T Lowest();
    constexpr __aicore__ static inline T Min();
    constexpr __aicore__ static inline T Infinity();
    constexpr __aicore__ static inline T NegativeInfinity();
    constexpr __aicore__ static inline T QuietNaN();
    constexpr __aicore__ static inline T SignalingNaN();
    constexpr __aicore__ static inline T DeNormMin();

    // Assign values to the first count elements of dstLocal.
    __aicore__ static inline void Max(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void Lowest(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void Min(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void Infinity(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void NegativeInfinity(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void QuietNaN(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void SignalingNaN(const LocalTensor<T> &dstLocal, uint32_t count);
    __aicore__ static inline void DeNormMin(const LocalTensor<T> &dstLocal, uint32_t count);
};