MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / rep

Function rep

dnn/src/naive/max_tensor_diff/opr_impl.cpp:15–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13float exec_forward(const T* src1, const T* src2, const size_t nr_elem) {
14 float maxerr = 0.f;
15 rep(i, nr_elem) {
16 float x = src1[i];
17 float y = src2[i];
18 float diff = std::isfinite(x) && std::isfinite(y)
19 ? fabs(x - y) / fmax(fmin(fabs(x), fabs(y)), 1)
20 : INFINITY;
21 maxerr = std::max(diff, maxerr);
22 }
23
24 return maxerr;
25}

Callers

nothing calls this directly

Calls 5

maxFunction · 0.85
isfiniteFunction · 0.50
fabsFunction · 0.50
fmaxFunction · 0.50
fminFunction · 0.50

Tested by

no test coverage detected