microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.52k stars 4.28k forks source link

RuntimeError: ONNX (Shape) is not supported in CNTK #3500

Open raulAtNines opened 6 years ago

raulAtNines commented 6 years ago

Hi,

I have a model trained in pytorch that I exported as onnx, and would like to try to run in CNTK for inference. CNTK/C++ failed to load the dictionary, so I tried CNTK/python-nightly, and got that error. RuntimeError: ONNX (Shape) is not supported in CNTK

Any workaround or timeline for onnx Shape support?

About to throw exception 'ONNX (Shape) is not supported in CNTK'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python\3.6\lib\site-packages\cntk\internal\swig_helper.py", line 69, in wrapper
    result = f(*args, **kwds)
  File "C:\Program Files\Python\3.6\lib\site-packages\cntk\ops\functions.py", line 1633, in load
    return cntk_py.Function.load(str(model), device, format.value)
RuntimeError: ONNX (Shape) is not supported in CNTK

[CALL STACK]
    > CNTK::DictionaryValue::FreePtrAsType<CNTK::NDShape>
    - CNTK::  XavierInitializer (x6)
    - CNTK::Function::  Load
    - PyInit__cntk_py (x2)
    - PyCFunction_FastCallDict
    - PyObject_CallFunctionObjArgs
    - PyEval_EvalFrameDefault
    - Py_CheckFunctionResult
    - PyCode_Optimize
    - PyEval_EvalFrameDefault

Relevant code: z = C.Function.load('my_model.onnx', format=C.ModelFormat.ONNX)

Thank you, Raul.

kestrelm commented 6 years ago

Hello, I too will like support for the Shape() operator. Also encountered a model trained with pytorch that threw this exception when running the onnx converted model.

Thanks

CmdQ commented 5 years ago

I too need this and I don't see why it is not supported. Because according to the docs, the Shape operator “has been available since version 1 of the default ONNX operator set.” On the other hand, CNTK seems to implement the ONNX 1.2 spec, so it should be included, shouldn't it?

rosrad commented 5 years ago

I need this operator ONNX (Shape) to be supported too, and also the ONNX (Split).