Skip to content

Commit

Permalink
Merge pull request #297 from Honry/fix-splice-issue
Browse files Browse the repository at this point in the history
Fix exception from splice
  • Loading branch information
huningxin authored Nov 14, 2024
2 parents 5be72c7 + 4403fc9 commit 570a55c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion face_recognition/facenet_nchw.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class FaceNetNchw {
const averagePool = this.builder_.averagePool2d(await block8_6);
// Use reshape to implement squeeze(averagePool, {axes: [2, 3]});
const squeezed_shape = typeof averagePool.shape === 'function' ?
averagePool.shape() : averagePool.shape;
averagePool.shape() : [...averagePool.shape];
squeezed_shape.splice(2, 2);
const squeeze = this.builder_.reshape(averagePool, squeezed_shape);
const gemm = await this.buildGemm_(squeeze);
Expand Down
4 changes: 2 additions & 2 deletions nsnet2/nsnet2.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NSNet2 {
{bias: bias194, recurrentBias: recurrentBias194, initialHiddenState: initialState92, returnSequence: true});
// Use reshape to implement squeeze(gru93, {axes: [1]});
const isShapeMethod = typeof gru93.shape === 'function';
const squeeze95Shape = isShapeMethod ? gru93.shape() : gru93.shape;
const squeeze95Shape = isShapeMethod ? gru93.shape() : [...gru93.shape];
squeeze95Shape.splice(1, 1);
const squeeze95 = this.builder_.reshape(gru93, squeeze95Shape);
const initialState155 = this.builder_.input('initialState155', initialStateDesc);
Expand Down Expand Up @@ -90,7 +90,7 @@ export class NSNet2 {
const [gru157, gru156] = this.builder_.gru(squeeze95, weight212, recurrentWeight213, frames, this.hiddenSize,
{bias: bias214, recurrentBias: recurrentBias214, initialHiddenState: initialState155, returnSequence: true});
// Use reshape to implement squeeze(gru156, {axes: [1]});
const squeeze158Shape = isShapeMethod ? gru156.shape() : gru156.shape;
const squeeze158Shape = isShapeMethod ? gru156.shape() : [...gru156.shape];
squeeze158Shape.splice(1, 1);
const squeeze158 = this.builder_.reshape(gru156, squeeze158Shape);
const transpose159 = this.builder_.transpose(squeeze158, {permutation: [1, 0, 2]});
Expand Down

0 comments on commit 570a55c

Please sign in to comment.