Skip to content

Commit b033ba9

Browse files
committed
Rebase fix
Signed-off-by: Ryan Nett <[email protected]>
1 parent be5ec1f commit b033ba9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.tensorflow.op.Ops;
4242
import org.tensorflow.op.Scope;
4343
import org.tensorflow.op.core.Placeholder;
44+
import org.tensorflow.op.core.PlaceholderWithDefault;
4445
import org.tensorflow.proto.framework.AttrValue;
4546
import org.tensorflow.proto.framework.DataType;
4647
import org.tensorflow.proto.framework.FunctionDef;
@@ -565,11 +566,17 @@ private static ConcreteFunction buildFromGraph(Graph graph, Signature signature)
565566
.collect(Collectors.toList());
566567

567568
List<GraphOperation> ops = new ArrayList<>(
568-
graph.completeSubgraph(new HashSet<>(inputs), new HashSet<>(outputs),
569-
null, Collections.singleton(Placeholder.OP_NAME)));
569+
graph.completeSubgraph(new HashSet<>(inputs), new HashSet<>(outputs)));
570570

571571
inputs.forEach(input -> ops.remove(input.op()));
572572

573+
ops.forEach(x -> {
574+
if(x.type().equals(Placeholder.OP_NAME) || x.type().equals(PlaceholderWithDefault.OP_NAME)){
575+
throw new IllegalArgumentException("Can't calculate outputs (" + outputs + ") from inputs (" + inputs + "), "
576+
+ "they also depend on \"" + x + "\"");
577+
}
578+
});
579+
573580
// Python sometimes has NoOps as outputs
574581
Ops tf = Ops.create(graph).withSubScope("functionControlOutputs");
575582
for (int i = 0; i < outputs.size(); i++) {

0 commit comments

Comments
 (0)