Structure describing permissible absolute and relative error bounds.
| 20 | |
| 21 | // Structure describing permissible absolute and relative error bounds. |
| 22 | struct ErrorSpec { |
| 23 | explicit ErrorSpec(float aabs, float arel = 0, bool relaxed_nans = false) |
| 24 | : abs(aabs), rel(arel), relaxed_nans(relaxed_nans) {} |
| 25 | |
| 26 | float abs; // Absolute error bound. |
| 27 | float rel; // Relative error bound. |
| 28 | |
| 29 | // If relaxed_nans is true then any result is valid if we are expecting NaNs. |
| 30 | // In effect, this allows the tested operation to produce incorrect results |
| 31 | // for inputs outside its mathematical domain. |
| 32 | bool relaxed_nans; |
| 33 | |
| 34 | // If this is true, then we treat each +/-inf in the actual result as |
| 35 | // equivalent to our choice of either +/-inf or the min/max floating-point |
| 36 | // value. |
| 37 | // |
| 38 | // If the expected result is +/-inf, the actual result must still be +/-inf. |
| 39 | // |
| 40 | // In effect, this allows the tested operation to overflow, so long as it's |
| 41 | // overflowing on "large" values. |
| 42 | // |
| 43 | // (We could have a symmetric more_infs_ok flag if necessary; right now it |
| 44 | // appears not to be.) |
| 45 | bool fewer_infs_ok = false; |
| 46 | }; |
| 47 | |
| 48 | } // namespace xla |
| 49 |
no outgoing calls