Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

TypeError: unrecognized operator 'Upsample' #117

Closed
christophstach opened this issue Mar 31, 2019 · 4 comments · Fixed by #207
Closed

TypeError: unrecognized operator 'Upsample' #117

christophstach opened this issue Mar 31, 2019 · 4 comments · Fixed by #207
Labels
enhancement New feature or request operator Related to one or more ONNX operators

Comments

@christophstach
Copy link

When using a style transfer model compiled to onnx, I get the following Error in onnxjs 0.1.5:

core.js:15724 ERROR Error: Uncaught (in promise): TypeError: unrecognized operator 'Upsample'
TypeError: unrecognized operator 'Upsample'

I am using the pytorch function

x = F.interpolate(x, mode='nearest', scale_factor=self.scale_factor)

which is translated to the onnx Upsample operator, wich is not supported in onnxjs yet.

@fs-eire fs-eire added enhancement New feature or request operator Related to one or more ONNX operators labels Apr 1, 2019
@gnsmrky
Copy link

gnsmrky commented Apr 1, 2019

@christophstach You will have to implement Upsample() by Concat() ops. Here is a working ONNX.js Fast Neural Style. Still buggy but should work ok on desktop browsers.

I am still working on putting up the modified PyTorch code to GitHub. Should be done soon.

@fs-eire
Copy link
Contributor

fs-eire commented Apr 1, 2019

Thanks to @gnsmrky for the explaination. According to latest ONNX spec, Unsample is deprecated in opset v10. Is there an equivalent alternative operator does the same thing?

@gnsmrky
Copy link

gnsmrky commented Apr 2, 2019

@fs-eire I believe the equivalent op would be Resize. Still need PyTorch ONNX export to change accordingly, though.

@gnsmrky
Copy link

gnsmrky commented Apr 24, 2019

@christophstach Take a look at my PyTorch fast-neural-style (FNS) for Web. I've put up all the details to make the PyTorch FNS work with ONNX.js. Some network model tweaking methods for running in browsers are mentioned. Should give you a good reference to make it run with ONNX.js.

More technical details for op replacements are at Making the PyTorch fast-neural-style (FNS) to ONNX.js conversion work in browsers. It talks about how to make the network compatible with ONNX.js by modifying the PyTorch codes.

Hope this helps you and everyone here to know how PyTorch --> ONNX.js works better.

:)

@fs-eire fs-eire linked a pull request Aug 13, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request operator Related to one or more ONNX operators
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants