Skip to content

Commit 570a55c

Browse files
authored
Merge pull request #297 from Honry/fix-splice-issue
Fix exception from splice
2 parents 5be72c7 + 4403fc9 commit 570a55c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

face_recognition/facenet_nchw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class FaceNetNchw {
269269
const averagePool = this.builder_.averagePool2d(await block8_6);
270270
// Use reshape to implement squeeze(averagePool, {axes: [2, 3]});
271271
const squeezed_shape = typeof averagePool.shape === 'function' ?
272-
averagePool.shape() : averagePool.shape;
272+
averagePool.shape() : [...averagePool.shape];
273273
squeezed_shape.splice(2, 2);
274274
const squeeze = this.builder_.reshape(averagePool, squeezed_shape);
275275
const gemm = await this.buildGemm_(squeeze);

nsnet2/nsnet2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class NSNet2 {
5959
{bias: bias194, recurrentBias: recurrentBias194, initialHiddenState: initialState92, returnSequence: true});
6060
// Use reshape to implement squeeze(gru93, {axes: [1]});
6161
const isShapeMethod = typeof gru93.shape === 'function';
62-
const squeeze95Shape = isShapeMethod ? gru93.shape() : gru93.shape;
62+
const squeeze95Shape = isShapeMethod ? gru93.shape() : [...gru93.shape];
6363
squeeze95Shape.splice(1, 1);
6464
const squeeze95 = this.builder_.reshape(gru93, squeeze95Shape);
6565
const initialState155 = this.builder_.input('initialState155', initialStateDesc);
@@ -90,7 +90,7 @@ export class NSNet2 {
9090
const [gru157, gru156] = this.builder_.gru(squeeze95, weight212, recurrentWeight213, frames, this.hiddenSize,
9191
{bias: bias214, recurrentBias: recurrentBias214, initialHiddenState: initialState155, returnSequence: true});
9292
// Use reshape to implement squeeze(gru156, {axes: [1]});
93-
const squeeze158Shape = isShapeMethod ? gru156.shape() : gru156.shape;
93+
const squeeze158Shape = isShapeMethod ? gru156.shape() : [...gru156.shape];
9494
squeeze158Shape.splice(1, 1);
9595
const squeeze158 = this.builder_.reshape(gru156, squeeze158Shape);
9696
const transpose159 = this.builder_.transpose(squeeze158, {permutation: [1, 0, 2]});

0 commit comments

Comments
 (0)