Fix invalid access in log call. (#8389)

Fix bug that shows up when running tests (in particular, GraphTransformationTests.ConcatSliceEliminationTest) with more verbose logging level.

There is a log statement that doesn't get evaluated at the default test logging level (warning). It was accessing the first element of an empty vector. This change moves that log statement before the point where that vector is cleared.
This commit is contained in:
Edward Chen 2021-07-14 15:09:45 -07:00 committed by GitHub
parent 0a1c00e8db
commit 88d1ffe9b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,6 @@ Status ConcatSliceElimination::ApplyImpl(Graph& graph, bool& modified, int graph
if (ConcatSliceElimination::FuseConcatSliceSubgraph(concat, graph, logger)) {
fused_count++;
LOGS(logger, INFO) << "Fused concat node: " << concat.OutputDefs()[0]->Name();
modified = true;
}
}
@ -244,6 +243,8 @@ bool ConcatSliceElimination::FuseConcatSliceSubgraph(Node& concat, Graph& graph,
replace_cnt++;
}
if (replace_cnt == 3) {
LOGS(logger, INFO) << "Fused concat node: " << concat.OutputDefs()[0]->Name();
//delete the slice nodes and concat node
graph_utils::RemoveNodeOutputEdges(graph, concat);
graph.RemoveNode(concat.Index());