Home
last modified time | relevance | path

Searched refs:node_map (Results 1 – 25 of 50) sorted by relevance

12

/external/tensorflow/tensorflow/core/grappler/utils/
Dtransitive_fanin_test.cc71 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 …]
Dgrappler_test_test.cc60 NodeMap node_map(&graph); in TEST_F() local
62 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "a", "Add_1", 0)); in TEST_F()
63 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "b", "Add_1", 1)); in TEST_F()
64 EXPECT_FALSE(IsNodesDirectlyConnected(node_map, "a", "Add_2", 0)); in TEST_F()
65 EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "b", "Add_2", 1)); in TEST_F()
Dcolocation.cc89 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/core/grappler/optimizers/
Dlayout_optimizer_test.cc240 NodeMap node_map(&output); in TEST_F() local
242 auto input_sizes_node = node_map.GetNode(input_name); in TEST_F()
244 auto conv2d_backprop_node = node_map.GetNode("Conv2DBackpropInput"); in TEST_F()
253 TensorShape filter_shape = GetAttrShape(*node_map.GetNode("Filter")); in TEST_F()
275 NodeMap node_map(&output); in TEST_F() local
276 auto conv2d_backprop_node = node_map.GetNode("Conv2DBackpropInput"); in TEST_F()
280 auto input_sizes_node = node_map.GetNode( in TEST_F()
296 NodeMap node_map(&output); in TEST_F() local
297 EXPECT_TRUE(node_map.GetNode("Conv2D-0-TransposeNHWCToNCHW-LayoutOptimizer")); in TEST_F()
309 NodeMap node_map(&output); in TEST_F() local
[all …]
Dscoped_allocator_optimizer_test.cc321 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()
377 NodeMap node_map(&optimized_graph); in TEST_F() local
379 GetNode(&node_map, "scoped_allocator_1_1", &nd); in TEST_F()
381 auto& nd_set = node_map.GetOutputs(nd->name()); in TEST_F()
[all …]
Dscoped_allocator_optimizer.cc151 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 …]
Dcommon_subgraph_elimination_test.cc83 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()
Dgraph_optimizer_stage_test.cc92 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()
Darithmetic_optimizer.cc115 GraphDef* graph, NodeMap* node_map) { in MaybeAddControlInput() argument
125 ConstantFolding::AddControlDependency(new_input, graph, node_map); in MaybeAddControlInput()
127 node_map->AddOutput(NodeName(new_input), node->name()); in MaybeAddControlInput()
137 const NodeDef& node, const NodeMap& node_map, in GetTailOfValuePreservingChain() argument
141 IsValuePreserving(node) && NumNonControlOutputs(node, node_map) == 1; in GetTailOfValuePreservingChain()
143 return GetTailOfChain(node, node_map, /*follow_control_input=*/false, in GetTailOfValuePreservingChain()
148 const NodeDef& node, const NodeMap& node_map, in GetTailOfIdempotentChain() argument
152 IsIdempotent(node) && NumNonControlOutputs(node, node_map) == 1; in GetTailOfIdempotentChain()
154 return GetTailOfChain(node, node_map, /*follow_control_input=*/false, in GetTailOfIdempotentChain()
235 ctx().node_map->AddOutput(NodeName(src->input(i)), in ForwardControlDependencies()
[all …]
Dmodel_pruner.cc203 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 …]
Dgraph_optimizer_stage.cc34 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()
Darithmetic_optimizer_test.cc131 NodeMap node_map(&output); in TEST_F() local
133 const NodeDef* square_node = node_map.GetNode(absl::StrCat(p, "_", "mul")); in TEST_F()
142 node_map.GetNode(absl::StrCat(p, "_", "mul_no_nan")); in TEST_F()
280 NodeMap node_map(&output); in TEST_F() local
287 const NodeDef* new_const = node_map.GetNode(optimized_const_name); in TEST_F()
294 const NodeDef* new_mul = node_map.GetNode(optimized_mul_name); in TEST_F()
300 const NodeDef* new_id = node_map.GetNode("id"); in TEST_F()
327 NodeMap node_map(&output); in TEST_F() local
334 const NodeDef* new_const = node_map.GetNode(optimized_const_name); in TEST_F()
341 const NodeDef* new_mul = node_map.GetNode(optimized_mul_name); in TEST_F()
[all …]
Dmemory_optimizer.cc91 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 …]
Dgraph_optimizer_stage.h51 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()
/external/tensorflow/tensorflow/python/grappler/
Dauto_mixed_precision_test.py298 node_map = {}
300 node_map[node.name] = node
301 return node_map
353 def _assert_output_f16(self, mode, node_map, node_name, output_port=0): argument
354 self.assertEqual(node_map[node_name].output_info[output_port].dtype,
415 node_map = _build_node_map(cost_graph.node)
423 optimized_type = node_map[node_name].output_info[output_port].dtype
446 node_map = _build_node_map(cost_graph.node)
449 self._assert_output_f16(mode, node_map, 'Conv2D')
450 self._assert_output_f16(mode, node_map, 'FusedBatchNormV3')
[all …]
/external/tensorflow/tensorflow/tools/graph_transforms/
Dfold_constants_test.cc253 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 …]
Dquantize_nodes_test.cc550 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 …]
Dfreeze_requantization_ranges_test.cc126 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()
Dtransform_utils_test.cc54 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/
Dutils_test.cc250 NodeMap node_map(&graph); in TEST_F() local
253 NodeDef* tail = GetTailOfChain(graph.node(5), node_map, in TEST_F()
260 return node.op() == "Neg" && NumNonControlOutputs(node, node_map) == 1; in TEST_F()
263 GetTailOfChain(graph.node(5), node_map, in TEST_F()
270 tail = GetTailOfChain(graph.node(7), node_map, in TEST_F()
277 tail = GetTailOfChain(graph.node(7), node_map, in TEST_F()
354 NodeMap node_map(&graph); in TEST_F() local
356 const NodeDef* add_node = node_map.GetNode("add"); in TEST_F()
357 const NodeDef* mul_node = node_map.GetNode("mul"); in TEST_F()
364 EXPECT_EQ(NumNonControlOutputs(*add_node, node_map), 2); in TEST_F()
[all …]
Dutils.cc229 bool HasRegularOutputs(const NodeDef& node, const NodeMap& node_map) { in HasRegularOutputs() argument
230 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in HasRegularOutputs()
243 bool HasControlOutputs(const NodeDef& node, const NodeMap& node_map) { in HasControlOutputs() argument
244 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in HasControlOutputs()
258 int NumControlOutputs(const NodeDef& node, const NodeMap& node_map) { in NumControlOutputs() argument
260 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumControlOutputs()
274 int NumNonControlOutputs(const NodeDef& node, const NodeMap& node_map) { in NumNonControlOutputs() argument
276 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumNonControlOutputs()
294 int NumNonControlDataOutputs(const NodeDef& node, const NodeMap& node_map) { in NumNonControlDataOutputs() argument
296 for (const NodeDef* output : node_map.GetOutputs(node.name())) { in NumNonControlDataOutputs()
[all …]
/external/tensorflow/tensorflow/compiler/tf2xla/
Dgraph_compiler_util.cc54 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()
Dfunctionalize_while.cc64 std::vector<Node*>* node_map, Graph* output) { in CopySubgraph() argument
96 if ((*node_map)[src->id()] == nullptr) { in CopySubgraph()
97 (*node_map)[src->id()] = output->CopyNode(src); in CopySubgraph()
100 Node* src_copy = (*node_map)[e->src()->id()]; in CopySubgraph()
104 Node* dst_copy = (*node_map)[e->dst()->id()]; in CopySubgraph()
129 std::vector<Node*> node_map(graph.num_node_ids(), nullptr); in BuildLoopCondition() local
139 node_map[arg.enter->id()] = arg_node; in BuildLoopCondition()
141 node_map[arg.merge->id()] = arg_node; in BuildLoopCondition()
147 TF_ASSIGN_OR_RETURN(node_map[frame->loop_cond->id()], in BuildLoopCondition()
154 &node_map, output); in BuildLoopCondition()
[all …]
/external/tensorflow/tensorflow/core/common_runtime/
Dconstant_folding.cc386 Node* n, std::unordered_map<Node*, std::vector<Node*>>* node_map, in AddNodeToConstantGraph() argument
388 std::vector<Node*>& added = (*node_map)[n]; in AddNodeToConstantGraph()
394 auto it = node_map->find(in); in AddNodeToConstantGraph()
395 CHECK(it != node_map->end()) in AddNodeToConstantGraph()
422 std::unordered_map<Node*, std::vector<Node*>>* node_map, in AddShapeNodeToConstantGraph() argument
424 std::vector<Node*>& added = (*node_map)[n]; in AddShapeNodeToConstantGraph()
452 std::unordered_map<Node*, std::vector<Node*>> node_map; in GetConstantGraph() local
453 node_map[orig_graph->source_node()] = {constant_graph->source_node()}; in GetConstantGraph()
454 node_map[orig_graph->sink_node()] = {constant_graph->sink_node()}; in GetConstantGraph()
457 AddNodeToConstantGraph(n, &node_map, constant_graph); in GetConstantGraph()
[all …]
/external/tensorflow/tensorflow/python/tools/
Doptimize_for_inference_lib.py138 node_map = {}
140 if node.name not in node_map:
141 node_map[node.name] = node
147 if input_node_name not in node_map:
161 def node_from_map(node_map, name): argument
175 if stripped_name not in node_map:
177 return node_map[stripped_name]

12