onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.37k stars 629 forks source link

Function save doesn't work when Exporting models from CNTK to ONNX #40

Open vackup opened 6 years ago

vackup commented 6 years ago

I'm using CNTK 2.5.1 (python and c#) and neither of them accept ModelFormat on Function.Save.

I'm getting the error:

Traceback (most recent call last): File "cntkexport.py", line 7, in z.save("frcn_svm.onnx", format=C.ModelFormat.ONNX) AttributeError: module 'cntk' has no attribute 'ModelFormat'

ebarsoum commented 6 years ago

@vackup can you share the code? ModelFormat is in cntk namespace.

vackup commented 6 years ago

This is my python script (cntkexport.py):

import  cntk  as C

model_path  = "ResNet20_CIFAR10_CNTK.model"
z = C.Function.load(model_path, device=C.device.cpu())

z.save("frcn_svm.onnx", format=C.ModelFormat.ONNX)