Skip to content

Commit

Permalink
Remove cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
caisq committed Feb 13, 2020
1 parent c459c5e commit 4a71937
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions speech-commands/src/browser_fft_recognizer.ts
Expand Up @@ -219,19 +219,16 @@ export class BrowserFftSpeechCommandRecognizer implements
const normalizedX = normalize(x);
let y: tf.Tensor;
let embedding: tf.Tensor;
let t0: number; // DEBUG
if (config.includeEmbedding) {
await this.ensureModelWithEmbeddingOutputCreated();
[y, embedding] =
this.modelWithEmbeddingOutput.predict(normalizedX) as tf.Tensor[];
} else {
t0 = Date.now(); // DEBUG
y = this.model.predict(normalizedX) as tf.Tensor;
}

const scores = await y.data() as Float32Array;
const t1 = Date.now();
console.log(`predict() took ${t1 - t0} ms`); // DEBUG
const maxIndexTensor = y.argMax(-1);
const maxIndex = (await maxIndexTensor.data())[0];
const maxScore = Math.max(...scores);
Expand Down

0 comments on commit 4a71937

Please sign in to comment.