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

Method Find

tensorflow/core/grappler/costs/graph_properties.cc:242–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240
241template <typename Handle>
242typename DisjointSet<Handle>::Rep* DisjointSet<Handle>::Find(Handle value) {
243 auto it = nodes_.find(value);
244 if (it == nodes_.end()) {
245 // This is the first time we process this handle, create an entry for it.
246 Rep* node = new Rep;
247 node->parent = node;
248 node->rank = 0;
249 processor_.ExtractValue(value, &node->value);
250 nodes_[value] = node;
251 return node;
252 }
253 // Return the representative for the set, which is the root of the tree. Apply
254 // path compression to speedup future queries.
255 Rep* node = it->second;
256 Rep* root = node->parent;
257 while (root != root->parent) {
258 root = root->parent;
259 }
260 while (node->parent != root) {
261 Rep* next = node->parent;
262 node->parent = root;
263 node = next;
264 }
265 return root;
266}
267
268// TODO(dyoon): Move many helper functions in this file (including those within
269// SymbolicShapeRefiner class) to shared utils.

Callers 15

TYPED_TESTFunction · 0.45
GetAttrMethod · 0.45
HasAttrMethod · 0.45
InferFromGraphViewTMethod · 0.45
TEST_FFunction · 0.45
IsSourceOrSinkOpMethod · 0.45
IsIndirectFunctionCallFunction · 0.45
FindFunctionCallFunction · 0.45
RemoveUnusedOutputsTypesFunction · 0.45

Calls 3

findMethod · 0.45
endMethod · 0.45
ExtractValueMethod · 0.45

Tested by 8

TYPED_TESTFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36