From a3e02e8e2a80ce0b471cb454c82809e10ed67594 Mon Sep 17 00:00:00 2001 From: Zimon Tai Date: Thu, 10 Aug 2023 06:42:30 +0800 Subject: [PATCH] Fix Resize op input check (#16594) ### Description onnxjs contains a `Resize` op input check which is outdated since opset 9. Currently `Resize` supports up to 4 inputs. This PR looses the input check. ### Motivation and Context Fixes #15636 --- js/web/lib/onnxjs/graph.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/web/lib/onnxjs/graph.ts b/js/web/lib/onnxjs/graph.ts index 4504f9aaba..f16da42815 100644 --- a/js/web/lib/onnxjs/graph.ts +++ b/js/web/lib/onnxjs/graph.ts @@ -332,8 +332,9 @@ class GraphImpl implements Graph, Graph.Transformer { for (const input of nodeProto.input) { const dataIndex = dataIndices.get(input); if (typeof dataIndex === 'undefined') { - // handle exception when opset > 9 and roi not given - if (input === '' && nodeProto.input.length === 3 && nodeProto.opType === 'Resize') { + // handle exception when opset > 9 and roi / scales not given + if (input === '' && (nodeProto.input.length === 3 || nodeProto.input.length === 4) && + nodeProto.opType === 'Resize') { continue; } throw new Error(`unrecognized input '${input}' for node: ${nodeProto.name}`);