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

Method SuppressInfrequent

tensorflow/core/graph/costmodel.cc:32–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30} // namespace
31
32void CostModel::SuppressInfrequent() {
33 // Find the median of the non-zero counts, and use half of its value
34 // as the cutoff for a "normal" execution mode node.
35 if (count_.empty()) return;
36 std::vector<int32> non_zero;
37 for (auto v : count_) {
38 if (v > 0) non_zero.push_back(v);
39 }
40 const size_t sz = non_zero.size();
41 if (sz > 0) {
42 std::nth_element(non_zero.begin(), non_zero.begin() + sz / 2,
43 non_zero.end());
44 int32 median_value = non_zero[sz / 2];
45 min_count_ = median_value / 2;
46 VLOG(1) << "num non_zero vals: " << non_zero.size() << " median_value "
47 << median_value;
48 } else {
49 min_count_ = 1;
50 }
51}
52
53void CostModel::MergeFromLocal(const Graph& g, const CostModel& cm) {
54 CHECK(is_global_);

Callers

nothing calls this directly

Calls 6

nth_elementFunction · 0.85
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected