Function: float_to_float16

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas training products

√

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

Description

Converts data of the float32 type to data of the aclFloat16 type.

Prototype

  • C Prototype
    1
    aclFloat16 aclFloatToFloat16(float value)
    
  • Python Function
    1
    output = acl.float_to_float16(value)
    

Parameters

Parameter

Description

value

float: data to be converted.

Return Values

Return Value

Description

output

Int, error code. 0 on success; else, failure.