/external/tensorflow/tensorflow/core/grappler/utils/ |
D | transitive_fanin_test.cc | 71 NodeMap node_map(&output_graph); in TEST_F() local 72 ASSERT_TRUE(node_map.NodeExists("1")); in TEST_F() 73 ASSERT_TRUE(node_map.NodeExists("2")); in TEST_F() 74 ASSERT_TRUE(node_map.NodeExists("3")); in TEST_F() 75 ASSERT_TRUE(node_map.NodeExists("4")); in TEST_F() 90 NodeMap node_map(&output_graph); in TEST_F() local 91 ASSERT_TRUE(node_map.NodeExists("1")); in TEST_F() 92 ASSERT_TRUE(node_map.NodeExists("2")); in TEST_F() 93 ASSERT_TRUE(node_map.NodeExists("3")); in TEST_F() 94 ASSERT_TRUE(node_map.NodeExists("4")); in TEST_F() [all …]
|
D | grappler_test_test.cc | 61 NodeMap node_map(&graph); in TEST_F() local 63 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "a", "Add_1", 0)); in TEST_F() 64 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "b", "Add_1", 1)); in TEST_F() 65 EXPECT_FALSE(IsNodesDirectlyConnected(node_map, "a", "Add_2", 0)); in TEST_F() 66 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "b", "Add_2", 1)); in TEST_F()
|
D | colocation.cc | 89 NodeMap node_map(graph); in ReassignColocation() local 112 NodeDef* node = node_map.GetNode(pair.first); in ReassignColocation() 123 NodeDef* node = node_map.GetNode(pair.first); in ReassignColocation()
|
/external/tensorflow/tensorflow/python/grappler/ |
D | auto_mixed_precision_test.py | 302 node_map = {} 304 node_map[node.name] = node 305 return node_map 357 def _assert_output_f16(self, mode, node_map, node_name, output_port=0): argument 358 self.assertEqual(node_map[node_name].output_info[output_port].dtype, 419 node_map = _build_node_map(cost_graph.node) 427 optimized_type = node_map[node_name].output_info[output_port].dtype 451 node_map = _build_node_map(cost_graph.node) 454 self._assert_output_f16(mode, node_map, 'Conv2D') 455 self._assert_output_f16(mode, node_map, 'FusedBatchNormV3') [all …]
|
/external/tensorflow/tensorflow/core/grappler/optimizers/ |
D | scoped_allocator_optimizer_test.cc | 321 void GetNode(NodeMap* node_map, const string& node_name, NodeDef** node_def) { in GetNode() argument 322 *node_def = node_map->GetNode(node_name); in GetNode() 328 NodeDef* ValidateSAControlInput(GraphDef* graph, NodeMap* node_map, in ValidateSAControlInput() argument 331 GetNode(node_map, node_name, &node); in ValidateSAControlInput() 342 GetNode(node_map, control_input_name, &control_input_node); in ValidateSAControlInput() 347 int NumControlInputs(NodeMap* node_map, const string& node_name) { in NumControlInputs() argument 349 GetNode(node_map, node_name, &node); in NumControlInputs() 378 NodeMap node_map(&optimized_graph); in TEST_F() local 380 GetNode(&node_map, "scoped_allocator_1_1", &nd); in TEST_F() 382 auto& nd_set = node_map.GetOutputs(nd->name()); in TEST_F() [all …]
|
D | scoped_allocator_optimizer.cc | 151 void RemoveNode(NodeDef* nd, GraphDef* graph, NodeMap* node_map) { in RemoveNode() argument 152 node_map->RemoveNode(nd->name()); in RemoveNode() 169 NodeDef* to_node, NodeMap* node_map) { in RemoveEdge() argument 182 if (node_map) { in RemoveEdge() 183 node_map->RemoveOutput(from_node_name, to_node->name()); in RemoveEdge() 217 NodeMap* node_map, const DataType& dtype, in MaybeRewriteInput() argument 243 node_map->AddNode(identity_name, identity); in MaybeRewriteInput() 244 node_map->AddOutput(input->name(), identity_name); in MaybeRewriteInput() 245 node_map->UpdateInput(op->name(), input->name(), identity_name); in MaybeRewriteInput() 260 NodeMap* node_map, const std::vector<NodeDef*>& ops, in GetInputs() argument [all …]
|
D | arithmetic_optimizer.cc | 118 GraphDef* graph, NodeMap* node_map) { in MaybeAddControlInput() argument 128 ConstantFolding::AddControlDependency(new_input, graph, node_map); in MaybeAddControlInput() 130 node_map->AddOutput(NodeName(new_input), node->name()); in MaybeAddControlInput() 140 const NodeDef& node, const NodeMap& node_map, in GetTailOfValuePreservingChain() argument 144 IsValuePreserving(node) && NumNonControlOutputs(node, node_map) == 1; in GetTailOfValuePreservingChain() 146 return GetTailOfChain(node, node_map, /*follow_control_input=*/false, in GetTailOfValuePreservingChain() 151 const NodeDef& node, const NodeMap& node_map, in GetTailOfIdempotentChain() argument 155 IsIdempotent(node) && NumNonControlOutputs(node, node_map) == 1; in GetTailOfIdempotentChain() 157 return GetTailOfChain(node, node_map, /*follow_control_input=*/false, in GetTailOfIdempotentChain() 221 ctx.node_map->RemoveInputs(node->name()); in ReplaceWithNoOp() [all …]
|
D | common_subgraph_elimination_test.cc | 83 NodeMap node_map(&output); in TEST_F() local 85 const NodeDef* new_c1 = node_map.GetNode("c1"); in TEST_F() 88 const NodeDef* new_div = node_map.GetNode("div"); in TEST_F() 123 NodeMap node_map(&output); in TEST_F() local 126 const NodeDef* new_div = node_map.GetNode("div"); in TEST_F() 154 NodeMap node_map(&output); in TEST_F() local 157 const NodeDef* new_c1 = node_map.GetNode("c1"); in TEST_F() 159 const NodeDef* new_c2 = node_map.GetNode("c2"); in TEST_F() 161 const NodeDef* new_mul1 = node_map.GetNode("mul1"); in TEST_F() 166 const NodeDef* new_div1 = node_map.GetNode("div1"); in TEST_F()
|
D | model_pruner.cc | 203 const NodeMap& node_map, const std::vector<string>& terminal_nodes, in IdentityNTerminalPorts() argument 214 NodeDef* node = node_map.GetNode(terminal_node); in IdentityNTerminalPorts() 227 NodeDef* curr_node = node_map.GetNode(curr); in IdentityNTerminalPorts() 276 GraphDef* graph, NodeMap* node_map) { in NewIdentityFromIdentityN() argument 281 if (node_map->NodeExists(new_node_name)) { in NewIdentityFromIdentityN() 293 node_map->AddNode(new_node->name(), new_node); in NewIdentityFromIdentityN() 294 node_map->AddOutput(NodeName(new_node->input(0)), new_node->name()); in NewIdentityFromIdentityN() 301 NodeMap* node_map) { in RewriteIdentityNAndInputsOutputs() argument 320 string identity = NewIdentityFromIdentityN(i, *node, graph, node_map); in RewriteIdentityNAndInputsOutputs() 332 for (NodeDef* output : node_map->GetOutputs(node->name())) { in RewriteIdentityNAndInputsOutputs() [all …]
|
D | graph_optimizer_stage_test.cc | 92 NodeMap node_map(&graph); in TEST_F() local 96 /*node_map*/ &node_map, in TEST_F() 121 NodeMap node_map(&graph); in TEST_F() local 125 /*node_map*/ &node_map, in TEST_F() 154 NodeMap node_map(&item.graph); in TEST_F() local 159 /*node_map*/ &node_map, in TEST_F() 196 NodeMap node_map(&item.graph); in TEST_F() local 201 /*node_map*/ &node_map, in TEST_F()
|
D | graph_optimizer_stage.cc | 34 NodeDef* node_by_name = ctx.node_map->GetNode(node_name); in GetInputNode() 77 CHECK(!ctx.node_map->NodeExists(name)) in AddCopyNode() 82 ctx.node_map->AddNode(name, new_node); in AddCopyNode() 88 for (int count = 0; ctx.node_map->NodeExists(new_name); ++count) { in AddEmptyNode() 94 ctx.node_map->AddNode(new_name, new_node); in AddEmptyNode()
|
D | arithmetic_optimizer_test.cc | 139 NodeMap node_map(&g); in TEST_F() local 141 const NodeDef* t = node_map.GetNode(absl::StrCat(p, "_", "Tile_mul")); in TEST_F() 142 const NodeDef* c = node_map.GetNode(absl::StrCat(p, "_", "Const_mul")); in TEST_F() 182 NodeMap node_map(&g); in TEST_F() local 184 const NodeDef* c = node_map.GetNode(absl::StrCat(p, "_", "Const_mul")); in TEST_F() 313 NodeMap node_map(&g); in TEST_F() local 316 node_map.GetNode(absl::StrCat(p, "_", "Reshape_reshape_b")); in TEST_F() 317 const NodeDef* rb = node_map.GetNode("reshape_b"); in TEST_F() 318 const NodeDef* t = node_map.GetNode(absl::StrCat(p, "_", "Tile_reshape_b")); in TEST_F() 370 NodeMap node_map(&output); in TEST_F() local [all …]
|
D | memory_optimizer.cc | 91 const NodeMap& node_map, const GraphDef* graph, in FindCandidateRecomputeNodes() argument 100 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in FindCandidateRecomputeNodes() 114 const NodeDef* input_node = node_map.GetNode(input_name); in FindCandidateRecomputeNodes() 128 void connected_subgraph(const NodeMap& node_map, bool collect_inputs, in connected_subgraph() argument 147 const NodeDef* input_node = node_map.GetNode(input_name_raw); in connected_subgraph() 155 for (const NodeDef* output : node_map.GetOutputs(current_node->name())) { in connected_subgraph() 171 const GraphDef* graph, const NodeMap& node_map, in GetOpGroupsToRecompute() argument 177 FindCandidateRecomputeNodes(node_map, graph, should_recompute, is_target); in GetOpGroupsToRecompute() 188 connected_subgraph(node_map, in GetOpGroupsToRecompute() 197 node_map.GetOutputs(unpruned_recompute_node->name())) { in GetOpGroupsToRecompute() [all …]
|
D | graph_optimizer_stage.h | 51 GraphProperties* graph_properties, NodeMap* node_map, in GraphOptimizerContext() 57 node_map(node_map), in GraphOptimizerContext() 64 NodeMap* node_map; member 211 while (ctx_.node_map->NodeExists(node_name)) { in UniqueNodeName()
|
D | loop_optimizer.cc | 520 NodeMap node_map(optimized_graph); in RemoveStackOps() local 540 push_node->input(1), optimized_graph, &node_map); in RemoveStackOps() 598 const NodeDef& switch_node, const NodeMap& node_map, in CheckForDeadFanout() argument 665 NodeDef* node = node_map.GetNode(input); in CheckForDeadFanout() 676 NodeDef* node = node_map.GetNode(input); in CheckForDeadFanout() 749 NodeMap node_map(optimized_graph); in Optimize() local 754 TF_RETURN_IF_ERROR(RemoveDeadBranches(item.NodesToPreserve(), node_map, in Optimize() 762 const std::unordered_set<string>& nodes_to_preserve, NodeMap& node_map, in RemoveDeadBranches() argument 782 TF_RETURN_IF_ERROR(CheckForDeadFanout(view, node, node_map, feed_nodes, in RemoveDeadBranches() 951 NodeDef* pred = node_map.GetNode(sw_node->input(1)); in RemoveDeadBranches() [all …]
|
/external/tensorflow/tensorflow/tools/graph_transforms/ |
D | fold_constants_test.cc | 253 std::map<string, const NodeDef*> node_map; in TestReplaceSendRecvs() local 254 graph_transforms::MapNamesToNodes(result_graph_def, &node_map); in TestReplaceSendRecvs() 255 EXPECT_EQ(1, node_map.count("original_recv")); in TestReplaceSendRecvs() 256 EXPECT_EQ(1, node_map.count("a_const")); in TestReplaceSendRecvs() 257 EXPECT_EQ(1, node_map.count("placeholder")); in TestReplaceSendRecvs() 258 EXPECT_EQ(1, node_map.count("original_send")); in TestReplaceSendRecvs() 259 EXPECT_EQ(0, node_map.count("_recv_placeholder_0")); in TestReplaceSendRecvs() 260 EXPECT_EQ(0, node_map.count("new_send")); in TestReplaceSendRecvs() 287 std::map<string, const NodeDef*> node_map; in TestReplaceSendRecvsPrefixNames() local 288 graph_transforms::MapNamesToNodes(result_graph_def, &node_map); in TestReplaceSendRecvsPrefixNames() [all …]
|
D | quantize_nodes_test.cc | 550 std::map<string, const NodeDef*> node_map; in TestRemoveRedundantQuantization() local 551 MapNamesToNodes(removed_graph_def, &node_map); in TestRemoveRedundantQuantization() 552 EXPECT_EQ(1, node_map.count("final_dequantize")); in TestRemoveRedundantQuantization() 553 EXPECT_EQ("quantized_op", node_map.at("final_dequantize")->input(0)); in TestRemoveRedundantQuantization() 649 std::map<string, const NodeDef*> node_map; in TestRemoveRedundantQuantizationWithBiasAdd() local 650 MapNamesToNodes(removed_graph_def, &node_map); in TestRemoveRedundantQuantizationWithBiasAdd() 651 EXPECT_EQ(1, node_map.count("final_dequantize")); in TestRemoveRedundantQuantizationWithBiasAdd() 652 EXPECT_EQ("requantize_op", node_map.at("final_dequantize")->input(0)); in TestRemoveRedundantQuantizationWithBiasAdd() 811 std::map<string, const NodeDef*> node_map; in TestQuantizePlaceholders() local 812 MapNamesToNodes(quantized_graph_def, &node_map); in TestQuantizePlaceholders() [all …]
|
D | freeze_requantization_ranges_test.cc | 126 std::map<string, const NodeDef*> node_map; in TestFreezeRequantizationRanges() local 127 MapNamesToNodes(frozen_graph_def, &node_map); in TestFreezeRequantizationRanges() 128 EXPECT_EQ(0, node_map.count("requantization_range_op")); in TestFreezeRequantizationRanges() 129 EXPECT_EQ(1, node_map.count("requantize_op")); in TestFreezeRequantizationRanges() 131 NodeNameFromInput(node_map.at("requantize_op")->input(3)); in TestFreezeRequantizationRanges() 132 ASSERT_EQ(1, node_map.count(min_input)); in TestFreezeRequantizationRanges() 133 EXPECT_EQ("Const", node_map.at(min_input)->op()); in TestFreezeRequantizationRanges() 135 NodeNameFromInput(node_map.at("requantize_op")->input(4)); in TestFreezeRequantizationRanges() 136 ASSERT_EQ(1, node_map.count(max_input)); in TestFreezeRequantizationRanges() 137 EXPECT_EQ("Const", node_map.at(max_input)->op()); in TestFreezeRequantizationRanges()
|
D | transform_utils_test.cc | 54 std::map<string, const NodeDef*> node_map; in TestMapNamesToNodes() local 55 MapNamesToNodes(graph_def, &node_map); in TestMapNamesToNodes() 57 EXPECT_EQ(1, node_map.count("a")); in TestMapNamesToNodes() 58 EXPECT_EQ(1, node_map.count("b")); in TestMapNamesToNodes() 59 EXPECT_EQ(1, node_map.count("add")); in TestMapNamesToNodes() 60 EXPECT_EQ(1, node_map.count("placeholder")); in TestMapNamesToNodes() 61 EXPECT_EQ(1, node_map.count("output")); in TestMapNamesToNodes() 62 EXPECT_EQ(0, node_map.count("no_such_node")); in TestMapNamesToNodes() 250 std::map<string, const NodeDef*> node_map; in TestFilterGraphDef() local 251 MapNamesToNodes(result_graph_def, &node_map); in TestFilterGraphDef() [all …]
|
/external/tensorflow/tensorflow/core/grappler/ |
D | utils_test.cc | 253 NodeMap node_map(&graph); in TEST_F() local 256 NodeDef* tail = GetTailOfChain(graph.node(5), node_map, in TEST_F() 263 return node.op() == "Neg" && NumNonControlOutputs(node, node_map) == 1; in TEST_F() 266 GetTailOfChain(graph.node(5), node_map, in TEST_F() 273 tail = GetTailOfChain(graph.node(7), node_map, in TEST_F() 280 tail = GetTailOfChain(graph.node(7), node_map, in TEST_F() 357 NodeMap node_map(&graph); in TEST_F() local 359 const NodeDef* add_node = node_map.GetNode("add"); in TEST_F() 360 const NodeDef* mul_node = node_map.GetNode("mul"); in TEST_F() 367 EXPECT_EQ(NumNonControlOutputs(*add_node, node_map), 2); in TEST_F() [all …]
|
D | utils.cc | 214 bool HasRegularOutputs(const NodeDef& node, const NodeMap& node_map) { in HasRegularOutputs() argument 215 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in HasRegularOutputs() 228 bool HasControlOutputs(const NodeDef& node, const NodeMap& node_map) { in HasControlOutputs() argument 229 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in HasControlOutputs() 243 int NumControlOutputs(const NodeDef& node, const NodeMap& node_map) { in NumControlOutputs() argument 245 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumControlOutputs() 259 int NumNonControlOutputs(const NodeDef& node, const NodeMap& node_map) { in NumNonControlOutputs() argument 261 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumNonControlOutputs() 279 int NumNonControlDataOutputs(const NodeDef& node, const NodeMap& node_map) { in NumNonControlDataOutputs() argument 281 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumNonControlDataOutputs() [all …]
|
/external/tensorflow/tensorflow/compiler/tf2xla/ |
D | graph_compiler_util.cc | 54 Status AddArgNodes(Graph* graph, const NodeMap& node_map, in AddArgNodes() argument 65 auto node_it = node_map.find(remap_it->second); in AddArgNodes() 66 if (node_it == node_map.end()) { in AddArgNodes() 114 Status AddRetvalNodes(Graph* graph, const NodeMap& node_map, in AddRetvalNodes() argument 119 auto it = node_map.find(id.node_name()); in AddRetvalNodes() 120 if (it == node_map.end()) { in AddRetvalNodes() 151 NodeMap node_map; in RewriteAndPruneGraph() local 153 node_map[n->name()] = n; in RewriteAndPruneGraph() 156 TF_RETURN_IF_ERROR(AddArgNodes(graph, node_map, config.feed(), feed_remapping, in RewriteAndPruneGraph() 159 AddRetvalNodes(graph, node_map, config.fetch(), &nodes_to_keep)); in RewriteAndPruneGraph()
|
D | functionalize_while.cc | 62 std::vector<Node*>* node_map, Graph* output) { in CopySubgraph() argument 94 if ((*node_map)[src->id()] == nullptr) { in CopySubgraph() 95 (*node_map)[src->id()] = output->CopyNode(src); in CopySubgraph() 98 Node* src_copy = (*node_map)[e->src()->id()]; in CopySubgraph() 102 Node* dst_copy = (*node_map)[e->dst()->id()]; in CopySubgraph() 127 std::vector<Node*> node_map(graph.num_node_ids(), nullptr); in BuildLoopCondition() local 137 node_map[arg.enter->id()] = arg_node; in BuildLoopCondition() 139 node_map[arg.merge->id()] = arg_node; in BuildLoopCondition() 145 TF_ASSIGN_OR_RETURN(node_map[frame->loop_cond->id()], in BuildLoopCondition() 152 &node_map, output); in BuildLoopCondition() [all …]
|
/external/tensorflow/tensorflow/core/common_runtime/ |
D | constant_folding.cc | 383 Node* n, std::unordered_map<Node*, std::vector<Node*>>* node_map, in AddNodeToConstantGraph() argument 385 std::vector<Node*>& added = (*node_map)[n]; in AddNodeToConstantGraph() 391 auto it = node_map->find(in); in AddNodeToConstantGraph() 392 CHECK(it != node_map->end()) in AddNodeToConstantGraph() 419 std::unordered_map<Node*, std::vector<Node*>>* node_map, in AddShapeNodeToConstantGraph() argument 421 std::vector<Node*>& added = (*node_map)[n]; in AddShapeNodeToConstantGraph() 449 std::unordered_map<Node*, std::vector<Node*>> node_map; in GetConstantGraph() local 450 node_map[orig_graph->source_node()] = {constant_graph->source_node()}; in GetConstantGraph() 451 node_map[orig_graph->sink_node()] = {constant_graph->sink_node()}; in GetConstantGraph() 454 AddNodeToConstantGraph(n, &node_map, constant_graph); in GetConstantGraph() [all …]
|
/external/tensorflow/tensorflow/python/tools/ |
D | optimize_for_inference_lib.py | 134 node_map = {} 136 if node.name not in node_map: 137 node_map[node.name] = node 143 if input_node_name not in node_map: 157 def node_from_map(node_map, name): argument 171 if stripped_name not in node_map: 173 return node_map[stripped_name]
|