Utils

Description

Common tool API class of the ATB

Definition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class Utils {
public:
    static std::string GetAtbVersion();
    static uint64_t GetTensorSize(const Tensor &tensor);
    static uint64_t GetTensorSize(const TensorDesc &tensorDesc);
    static uint64_t GetTensorNumel(const Tensor &tensor);
    static uint64_t GetTensorNumel(const TensorDesc &tensorDesc);
    static void QuantParamConvert(const float *src, uint64_t *dest, uint64_t itemCount);
    static Status SetLogLevel(const atb::LogLevel atbLogLevel); 
    static Status ResetLogLevel();
};

Members

Member

Description

GetAtbVersion

Returns the version information of the ATB.

GetTensorSize

Returns the data storage size of a tensor object.

GetTensorNumel

Returns the number of data of a tensor object.

QuantParamConvert

This parameter is used in quantization scenarios. It converts a float array into a uint64 array by copying the float array to the last 32 bits of the uint64 array and setting the first 32 to 0.

  • src: input float array
  • dest: uint64 array obtained after conversion
  • itemCount: number of array elements

SetLogLevel

Sets the log level of the ATB during program execution.

  • atbLogLevel: log level of the ATB.

ResetLogLevel

Restores the log level to the environment variable setting.