Numpy float16is a weird and possibly evil beast. This is an IEEE 754 half-precision floating-point number with a 1-bit sign, 5 bits of the exponent, and 10 bits of the mantissa.
While this is a standard floating point number, it is new and not widely used. Some GPUs support it, but hardware support is not common on the CPU. Newer processors have instructions for converting between 16-bit and 32-bit floats, but there is no support to use it directly in mathematical operations. Because of this, and due to the lack of suitable data types in ordinary lower-level languages, the 16-bit float is slower than its 32-bit counterpart.
. 16- float , 32- float.
:
In [60]: r=random.random(1000000).astype('float32')
In [61]: %timeit r*r
1000 loops, best of 3: 435 us per loop
In [62]: r=random.random(1000000).astype('float16')
In [63]: %timeit r*r
100 loops, best of 3: 10.9 ms per loop
, . :
In [72]: array([3001], dtype='float16') - array([3000], dtype='float16')
Out[72]: array([ 0.], dtype=float32)