Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #343 from pinzhenx/wasmRB
Browse files Browse the repository at this point in the history
[WASM] support RESIZE_BILINEAR op
  • Loading branch information
huningxin authored Nov 28, 2018
2 parents 1cd70f6 + 05d1c28 commit 4778f20
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/nn/wasm/PreparedModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,24 @@ export default class PreparedModel {
throw new Error('fullyConnectedFloat32 fails');
}
} break;
case OperationCode.RESIZE_BILINEAR: {
allParametersPresent(3, 1);
let input = operands[inputs[0]];
let newHeight = operands[inputs[1]].value[0];
let newWidth = operands[inputs[2]].value[0];
let output = operands[outputs[0]];
success = nn_ops.resizeBilinearPrepare(input.shape,
newHeight, newWidth,
output.shape);
if (!success) {
throw new Error('resizeBilinearPrepare fails');
}
success = nn_ops.resizeBilinearFloat32(input.value, input.shape,
output.value, output.shape);
if (!success) {
throw new Error('resizeBilinearFloat32 fails');
}
} break;
default: {
throw new Error(`Operation ${op} is not supported`);
}
Expand Down Expand Up @@ -475,4 +493,4 @@ export default class PreparedModel {
operand.value = null;
})
}
}
}
2 changes: 1 addition & 1 deletion src/nn/wasm/nn_ops.js

Large diffs are not rendered by default.

0 comments on commit 4778f20

Please sign in to comment.