Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the model through Onnx #4

Open
TommasoBendinelli opened this issue Dec 20, 2019 · 2 comments
Open

Export the model through Onnx #4

TommasoBendinelli opened this issue Dec 20, 2019 · 2 comments

Comments

@TommasoBendinelli
Copy link

Hello,
I have successfully run the network getting the results in the result_mvae folder. I would like to export the model into other deep learning frameworks (i.e. TensorFlow). Particularly I tried to do it through onnx_chainer.export with the following:

x = np.zeros(1,7,128,128, type=np.float32)
onnx_chainer.export(model, x, filename='export.onnx')

where model is from net.Conv_MVAE

Unfortunately I get the following error:
incompatible array mixed in the forward'sd input (Concat)
Actual: <class 'numpy.ndarray'>, <class 'copy.core.core.ndarray>

I tried also to change x as cupy.zeros((1,7,128,128), type=cupy.float32) but I still get similar error

@yordanh
Copy link
Owner

yordanh commented Dec 31, 2019

Hi,

Unfortunately I don't have much experience with onnx and exporting models like this. From what I can see in your message above, some of the concats we are doing in the forward pass fail, potentially because we are concatenating cupy with bumpy arrays. Notice that in the spatial decoding step, the xy tiled 1s are defined as a cupy array.

Is the message above the full error trace and is the message different when you initialise X as a copy array or exactly the same?

@TommasoBendinelli
Copy link
Author

Hi,
I managed to the issue by passing the following:
import onnx_chainer onnx_chainer.export(model, cp.array(train[0:1]), filename='test.onnx')

where train is the output from the DataGenerator.

Unfortunately It still raises a (new) exception:
ValueError: The all 'outputs' must be Chainer Variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants