MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / max_err

Method max_err

src/model.cpp:913–934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913float 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected