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

Method insert

tensorflow/core/graph/edgeset.cc:20–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace tensorflow {
19
20std::pair<EdgeSet::const_iterator, bool> EdgeSet::insert(value_type value) {
21 RegisterMutation();
22 const_iterator ci;
23 ci.Init(this);
24 auto s = get_set();
25 if (!s) {
26 for (int i = 0; i < kInline; i++) {
27 if (ptrs_[i] == value) {
28 ci.array_iter_ = &ptrs_[i];
29 return std::make_pair(ci, false);
30 }
31 }
32 for (int i = 0; i < kInline; i++) {
33 if (ptrs_[i] == nullptr) {
34 ptrs_[i] = value;
35 ci.array_iter_ = &ptrs_[i];
36 return std::make_pair(ci, true);
37 }
38 }
39 // array is full. convert to set.
40 s = new gtl::FlatSet<const Edge*>;
41 s->insert(reinterpret_cast<const Edge**>(std::begin(ptrs_)),
42 reinterpret_cast<const Edge**>(std::end(ptrs_)));
43 ptrs_[0] = this;
44 ptrs_[1] = s;
45 // fall through.
46 }
47 auto p = s->insert(value);
48 ci.tree_iter_ = p.first;
49 return std::make_pair(ci, p.second);
50}
51
52EdgeSet::size_type EdgeSet::erase(key_type key) {
53 RegisterMutation();

Callers 15

GetStaticGraphOpsMethod · 0.45
RunMethod · 0.45
FindGatherNodeFunction · 0.45
InternalFindUniqueNodeFunction · 0.45
CreateStringJoinOpFunction · 0.45
CreateConcatOpFunction · 0.45

Calls 1

InitMethod · 0.45

Tested by 15

TestRemoveNodesMethod · 0.36
TestRemoveOutputNodesMethod · 0.36
TestConstantFoldingMethod · 0.36
TestNameClashesMethod · 0.36
TestRenameOpMethod · 0.36
TestInsertLoggingMethod · 0.36
TESTFunction · 0.36
TestRenameAttributeMethod · 0.36