finfo¶
- paddle. finfo ( dtype ) [source]
-
paddle.finfo
is a function that returns an object that represents the numerical properties of a floating pointpaddle.dtype
. This is similar to numpy.finfo.- Parameters
-
dtype (paddle.dtype) – One of
paddle.float16
,paddle.float32
,paddle.float64
,paddle.bfloat16
,paddle.complex64
, andpaddle.complex128
. - Returns
-
min(double): The smallest representable number (typically -max).
max(double): The largest representable number.
eps(double): The smallest representable number such that 1.0 + eps ≠ 1.0.
resolution(double): The approximate decimal resolution of this type, i.e., 10**-precision.
smallest_normal(double): The smallest positive normal number.
tiny(double): The smallest positive normal number. Equivalent to smallest_normal.
bits(int): The number of bits occupied by the type.
dtype(str): The string name of the argument dtype.
- Return type
-
An
finfo
object, which has the following 8 attributes
Examples
import paddle finfo_float32 = paddle.finfo(paddle.float32) print(finfo_float32.min) # -3.40282e+38 print(finfo_float32.max) # 3.40282e+38 print(finfo_float32.eps) # 1.19209e-07 print(finfo_float32.resolution) # 1e-06 print(finfo_float32.smallest_normal) # 1.17549e-38 print(finfo_float32.tiny) # 1.17549e-38 print(finfo_float32.bits) # 32 print(finfo_float32.dtype) # float32