Skip to content

Commit

Permalink
Replace squeeze with reshape for facenet_nchw.js (webmachinelearning#194
Browse files Browse the repository at this point in the history
)
  • Loading branch information
huningxin authored and Honry committed May 15, 2024
1 parent 5d98ae3 commit 064c4c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion face_recognition/facenet_nchw.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ export class FaceNetNchw {
block8_5, 6, ['977', '1104', '978', '1080', '1086'], false);

const averagePool = this.builder_.averagePool2d(block8_6);
const squeeze = this.builder_.squeeze(averagePool, {axes: [2, 3]});
// Use reshape to implement squeeze(averagePool, {axes: [2, 3]});
const squeezed_shape = averagePool.shape();
squeezed_shape.splice(2, 2);
const squeeze = this.builder_.reshape(averagePool, squeezed_shape);
const gemm = await this.buildGemm_(squeeze);
// L2Normalization will be handled in post-processing
return gemm;
Expand Down

0 comments on commit 064c4c4

Please sign in to comment.