Webgl not supporting "ReduceL2" (when loading an onnx file)

(Benjamin) #1


I am trying to load in a .onnx file into a javascript session. The error I am receiving is TypeError: unrecognized operator ‘ReduceL2’, but this link https://github.com/onnx/onnx/blob/master/docs/Operators.md is saying that ‘ReduceL2’ is supported by onnx. I am guessing that it could have something to do with webGL not supporting it. Are there any work arounds or a better way to approach running a model in browser? very new to javascript.

JavaScript Code:

async function runExample() {
  // Create an ONNX inference session with WebGL backend.
  const session = new onnx.InferenceSession({ backendHint: 'webgl' });

  // Load an ONNX model. This model is Resnet50 that takes a 1*3*224*224 image and classifies it.
  await session.loadModel("./pathtomodel");

Error Thrown:

Uncaught (in promise) TypeError: unrecognized operator 'ReduceL2'
    at t.createOperator (session-handler.ts:222)
    at t.resolve (session-handler.ts:86)
    at e.initializeOps (session.ts:252)
    at session.ts:92
    at t.event (instrument.ts:294)
    at e.initialize (session.ts:81)
    at e.<anonymous> (session.ts:63)
    at inference-session-impl.ts:16
    at Object.next (inference-session-impl.ts:16)
    at a (inference-session-impl.ts:16)