Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138221

onnx.js : Cannot read property 'webgl' of undefined

$
0
0

I tried the onnx.js (Getting Started example) from their git repository and it worked as expected.

Now I'm trying the same thing with node.js and webpack, but I'm getting a weird error when loading the model.

onnx.min.js:14 Uncaught (in promise) TypeError: Cannot read property 'webgl' of undefined

the code

import { Tensor, InferenceSession } from "onnxjs";

const init = async ()=>{  
    const session = new InferenceSession({ backendHint: 'webgl'});
    await session.loadModel("./models/onnx/squeeze_net.onnx")
    ...
}

init();

The model path is correct, loaded successfully with Axios.

The same error is returned with backendHint set to cpu or wasm

onnx.min.js:14 Uncaught (in promise) TypeError: Cannot read property 'cpu' of undefined

onnx.min.js:14 Uncaught (in promise) TypeError: Cannot read property 'wasm' of undefined

Viewing all articles
Browse latest Browse all 138221

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>