[XLA:CPU/GPU] Fix a problem in the random number generator for F16.
ConvertValueForDistribution incorrectly uses the element type to perform the division that reduces the raw value to the range of [0, 1). When the element type is F16, the result of a division result is always zero due to overflow and the generator always generates a value equal to the lower bound of the requested range. To fix this problem, we perform the division using the float type with the same number of bits as the raw value type. PiperOrigin-RevId: 207662942
Loading
Please sign in to comment