Skip to content

Commit

Permalink
Nit
Browse files Browse the repository at this point in the history
  • Loading branch information
axinging committed Nov 4, 2022
1 parent 8976a0f commit de84a0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions e2e/benchmarks/local-benchmark/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,14 @@ <h2>TensorFlow.js Model Benchmark</h2>
async function predictAndGetData(predict, model, inferenceInput, enableDump) {
const prediction = await predict(model, inferenceInput);
let intermediateData = {};
let graphModel = null;
if (enableDump) {
graphModel = getGraphModel(model);
const graphModel = getGraphModel(model);
if (graphModel) {
intermediateData = await getIntermediateTensorInfo(graphModel.getIntermediateTensors());
graphModel.disposeIntermediateTensors();
}
}
const predictionData = await getPredictionData(prediction);
if (graphModel) {
graphModel.disposeIntermediateTensors();
}
return {data: predictionData, intermediateData};
}

Expand Down
6 changes: 3 additions & 3 deletions tfjs-converter/src/executor/graph_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ export class GraphExecutor implements FunctionExecutor {
outputNodeNames, intermediateTensorConsumerCount);
}
}
if (this.keepIntermediateTensors) {
this.clonedTensorsMap = this.cloneTensorMap(tensorsMap);
}
// dispose the context for the root executor
if (this.parent == null) {
context.dispose(tensorsToKeep);
}
if (this.keepIntermediateTensors) {
this.clonedTensorsMap = this.cloneTensorMap(tensorsMap);
}

return outputs.map(name => getTensor(name, tensorsMap, context));
});
Expand Down

0 comments on commit de84a0e

Please sign in to comment.