Skip to content

Commit dd5439a

Browse files
committed
Change eager mode control inputs from exception to no-op, reflecting eager semantics. (tensorflow#158)
* Change eager mode control inputs from exception to no-op, reflecting eager semantics. Signed-off-by: Ryan Nett <[email protected]> * fix test to reflect not throwing exception Signed-off-by: Ryan Nett <[email protected]>
1 parent 84b2e63 commit dd5439a

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public EagerOperationBuilder addInputList(Output<?>[] inputs) {
9090

9191
@Override
9292
public OperationBuilder addControlInput(Operation control) {
93-
throw new UnsupportedOperationException(
94-
"Control inputs are not supported in an eager execution environment");
93+
// No-op. Any operations passed to this method will already be evaluated (b/c eager evaluation).
94+
return this;
9595
}
9696

9797
@Override

tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerOperationBuilderTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ public void addInputs() {
6161
.addInput(tf.constant(true).asOutput())
6262
.addInputList(new Output<?>[] {tf.constant(-1).asOutput()})
6363
.build();
64-
try {
65-
opBuilder(session, "Const", "var").addControlInput(asrt);
66-
fail();
67-
} catch (UnsupportedOperationException e) {
68-
// expected
69-
}
64+
opBuilder(session, "Const", "var").addControlInput(asrt);
7065
}
7166
}
7267

0 commit comments

Comments
 (0)