Skip to content

Commit

Permalink
Replace squeeze with reshape for facenet_nchw.js (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
huningxin authored Feb 27, 2024
1 parent c894ab0 commit 2e28fac
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 2e28fac

Please sign in to comment.