microsoft / onnxjs

ONNX.js: run ONNX models using JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v12

jimeffry opened this issue · comments

When I run the onnx model in onnx.js environment, I get the problem as below.

 opset.ts:48 Uncaught (in promise) TypeError: cannot resolve operator 'Shape' with opsets: ai.onnx v12
    at Object.e.resolveOperator (opset.ts:48)
    at t.resolve (session-handler.ts:60)
    at e.initializeOps (session.ts:235)
    at session.ts:92
    at t.event (instrument.ts:294)
    at e.initialize (session.ts:81)
    at e.<anonymous> (session.ts:63)
    at onnx.min.js:14
    at Object.next (onnx.min.js:14)
    at a (onnx.min.js:14)

And the javascript code is here.

<script src="https://cdn.jsdelivr.net/npm/onnxjs/dist/onnx.min.js"></script>
<script src="script.js"></script>

The codes of onnx model inference lies in script.js. The error part is below.

const sess = new onnx.InferenceSession();
const loadingModelPromise = sess.loadModel("facedetect_int32.onnx");

We look forward to your reply!Thanks

How about using the alternatives like,
https://cdn.jsdelivr.net/npm/onnxjs@0.1.7/dist/onnx.min.js

@helloahn Thank you very much for your reply ! Another new problem has arisen.(#310 )

I also have erros like that

Uncaught (in promise) TypeError: cannot resolve operator 'Cast' with opsets: ai.onnx v12