Skip to content

Commit 978848d

Browse files
committed
Back to ArrayDeque
Signed-off-by: Ryan Nett <[email protected]>
1 parent a8f6114 commit 978848d

File tree

1 file changed

+3
-3
lines changed
  • tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow

1 file changed

+3
-3
lines changed

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public synchronized Set<GraphOperation> completeSubgraph(Set<Operand<?>> inputs,
280280
throw new IllegalArgumentException("Outputs can't be null.");
281281
}
282282

283-
Queue<GraphOperation> currents = new LinkedList<>();
283+
Queue<GraphOperation> currents = new ArrayDeque<>(outputs.size());
284284
Set<GraphOperation> seen = new LinkedHashSet<>(inputs.size());
285285
Set<GraphOperation> inputOps = new LinkedHashSet<>(inputs.size());
286286

@@ -345,7 +345,7 @@ public synchronized Set<GraphOperation> completeSubgraph(Set<Operand<?>> inputs,
345345
*/
346346
public Set<GraphOperation> upstreamOps(Set<GraphOperation> outputs) {
347347
Set<GraphOperation> seen = new LinkedHashSet<>(outputs.size());
348-
Queue<GraphOperation> todo = new LinkedList<>(outputs);
348+
Queue<GraphOperation> todo = new ArrayDeque<>(outputs);
349349
while (!todo.isEmpty()) {
350350
GraphOperation current = todo.poll();
351351

@@ -367,7 +367,7 @@ public Set<GraphOperation> upstreamOps(Set<GraphOperation> outputs) {
367367
*/
368368
public synchronized Set<GraphOperation> downstreamOps(Set<GraphOperation> inputs) {
369369
Set<GraphOperation> seen = new LinkedHashSet<>(inputs.size());
370-
Queue<GraphOperation> todo = new LinkedList<>(inputs);
370+
Queue<GraphOperation> todo = new ArrayDeque<>(inputs);
371371
while (!todo.isEmpty()) {
372372
GraphOperation current = todo.poll();
373373

0 commit comments

Comments
 (0)