| 911 | } |
| 912 | |
| 913 | float DebugTensor::max_err(const DebugTensor& other) const { |
| 914 | if (data_type != other.data_type) { |
| 915 | return -1; |
| 916 | } |
| 917 | if (data_type == DataType::F32) { |
| 918 | float max_err = 0; |
| 919 | for (size_t i = 0; i < data_f32.size(); i++) { |
| 920 | max_err = std::max(max_err, std::abs(data_f32[i] - other.data_f32[i])); |
| 921 | } |
| 922 | return max_err; |
| 923 | } else { |
| 924 | #if defined(__F16C__) |
| 925 | float max_err = 0; |
| 926 | for (size_t i = 0; i < data_f16.size(); i++) { |
| 927 | max_err = std::max(max_err, std::abs(_cvtsh_ss(data_f16[i]) - _cvtsh_ss(other.data_f16[i]))); |
| 928 | } |
| 929 | return max_err; |
| 930 | #else |
| 931 | assert(false && "float16 not supported on this platform"); |
| 932 | #endif |
| 933 | } |
| 934 | } |
| 935 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected