Skip to content

Commit

Permalink
Remove unnecessary "disposes" of tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
bernieOllie committed Jun 3, 2020
1 parent d032372 commit 0f8232e
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class App extends React.Component {
tf.engine().startScope();
const predictions = model.predict(this.process_input(video));
this.renderPredictions(predictions);
predictions.dispose();
requestAnimationFrame(() => {
this.detectFrame(video, model);
});
Expand All @@ -77,12 +76,6 @@ class App extends React.Component {
const std = tf.tensor3d([0.229, 0.224, 0.225], [1,1,3]);
const normalised = img.div(scale).sub(mean).div(std);
const batched = normalised.transpose([2,0,1]).expandDims();
img.dispose();
scale.dispose();
mean.dispose();
std.dispose();
normalised.dispose();
batched.dispose();
return batched;
};
renderPredictions = async (predictions) => {
Expand Down

0 comments on commit 0f8232e

Please sign in to comment.