Rate This Document
Findability
Accuracy
Completeness
Readability

vf16cvtfloat

Convert the FP16 data type to float.

Interface Definition

C interface:

void vf16cvtfloat(const int len, const __fp16 *src, float *dst);

Parameters

Parameter

Type

Description

Input/Output

len

Integer

Number of elements in the input vector.

If len ≤ 0, an invalid parameter error is reported and the function returns.

Input

src

FP16

Input vector src with length len.

If the pointer is null, a null pointer error is reported and the function returns.

Input

dst

Single-precision floating-point

Output vector dst with length len.

If the pointer is null, a null pointer error is reported and the function returns.

Output

Dependencies

C: "kvml.h"

Examples

C interface:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    const int len = 8;
    __fp16 src[8] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; // __fp16 array
    float dst[8]; // Array for storing the converted float values

    vf16cvtfloat(len, src, dst);

    /** 
     *  Output dst: 
     *     1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000
     */