Skip to content

Commit 2c50519

Browse files
YoniTsafirrmlarsen
authored andcommitted
Add a way to provide target nodes in Android (tensorflow#14722)
* Add a way to provide target nodes in Android This is required when running some models as a step for initializing the graph etc. * Fix enableStats mistake on overload Falsely passed enableStats as false instead of the parameter for the non overloaded version.
1 parent 62b54bf commit 2c50519

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tensorflow/contrib/android/java/org/tensorflow/contrib/android/TensorFlowInferenceInterface.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ public void run(String[] outputNames) {
194194
* @param outputNames A list of output nodes which should be filled by the inference pass.
195195
*/
196196
public void run(String[] outputNames, boolean enableStats) {
197+
run(outputNames, enableStats, new String[] {});
198+
}
199+
200+
/**
201+
* An overloaded version of runInference that allows supplying targetNodeNames as well
202+
*/
203+
public void run(String[] outputNames, boolean enableStats, String[] targetNodeNames) {
197204
// Release any Tensors from the previous run calls.
198205
closeFetches();
199206

@@ -204,6 +211,11 @@ public void run(String[] outputNames, boolean enableStats) {
204211
runner.fetch(tid.name, tid.outputIndex);
205212
}
206213

214+
// Add targets.
215+
for (String t : targetNodeNames) {
216+
runner.addTarget(t);
217+
}
218+
207219
// Run the session.
208220
try {
209221
if (enableStats) {

0 commit comments

Comments
 (0)