MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetMatrixStats

Function GetMatrixStats

tensorflow/lite/experimental/ruy/test.h:1254–1273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252
1253template <typename Scalar>
1254void GetMatrixStats(const Matrix<Scalar>& matrix, Stats* stats) {
1255 double min = std::numeric_limits<double>::infinity();
1256 double max = -std::numeric_limits<double>::infinity();
1257 double sum = 0;
1258 std::vector<double> allvals;
1259 for (int row = 0; row < matrix.layout.rows; row++) {
1260 for (int col = 0; col < matrix.layout.cols; col++) {
1261 double val = Element(matrix, row, col);
1262 min = std::min(min, val);
1263 max = std::max(max, val);
1264 sum += val;
1265 allvals.push_back(val);
1266 }
1267 }
1268 std::sort(allvals.begin(), allvals.end());
1269 stats->min = min;
1270 stats->max = max;
1271 stats->mean = sum / allvals.size();
1272 stats->median = allvals[allvals.size() / 2];
1273}
1274
1275struct ErrorAnalysis {
1276 Stats stats_good;

Callers 1

AnalyzeTestErrorFunction · 0.85

Calls 9

infinityFunction · 0.85
sortFunction · 0.85
ElementFunction · 0.70
minFunction · 0.50
maxFunction · 0.50
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected