[XLA] Handle denormals explicitly in exhaustive_f32_elementwise_op_test.
Previously, we expected that fn(x) would return something close to std::fn(x), even if x was denormal. Now, we accept a result that's close to either std::fn(x) or std::fn(0). As an example of why we need this fix, let x be a negative denormal, and consider log(x). log of any negative number (other than -0) should be nan. But log(+/-0) is -inf. XLA:CPU (and indeed, all of TF) runs in a mode where if x is denormal, x == 0 is true. So although XLA:CPU's generated code correctly handles negative denormal inputs to log, it's thwarted by this hardware mode and returns -inf for log(x). PiperOrigin-RevId: 231872731
Loading
Please sign in to comment