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

Method ReduceToRowArray2D

tensorflow/compiler/xla/reference_util.cc:521–536  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

519}
520
521/* static */ std::unique_ptr<std::vector<float>>
522ReferenceUtil::ReduceToRowArray2D(
523 const Array2D<float>& matrix, float init,
524 const std::function<float(float, float)>& reduce_function) {
525 int64 rows = matrix.height();
526 int64 cols = matrix.width();
527 auto result = absl::make_unique<std::vector<float>>();
528 for (int64 i = 0; i < cols; ++i) {
529 float acc = init;
530 for (int64 j = 0; j < rows; ++j) {
531 acc = reduce_function(acc, matrix(j, i));
532 }
533 result->push_back(acc);
534 }
535 return result;
536}
537
538/*static*/ std::vector<float> ReferenceUtil::Reduce4DTo1D(
539 const Array4D<float>& array, float init, absl::Span<const int64> dims,

Callers

nothing calls this directly

Calls 4

matrixFunction · 0.85
heightMethod · 0.45
widthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected