From 2e28fac2c7f9a5ce3ca067651c70d7ebe662566e Mon Sep 17 00:00:00 2001 From: Ningxin Hu Date: Tue, 27 Feb 2024 09:47:04 +0800 Subject: [PATCH] Replace squeeze with reshape for facenet_nchw.js (#194) --- face_recognition/facenet_nchw.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/face_recognition/facenet_nchw.js b/face_recognition/facenet_nchw.js index 1a7d76fd..d33ef09d 100644 --- a/face_recognition/facenet_nchw.js +++ b/face_recognition/facenet_nchw.js @@ -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;