Converting a model with a matrix multiplication (PyTorch) #936
Replies: 2 comments 2 replies
-
Well, that is a bit unrelated as the question is neither about TorchScript nor ONNX. @itzakkk The extension API is not yet supported well with PyTorch, we're still working on it. However, you can still achieve what you want by creating a custom function and decorating it with |
Beta Was this translation helpful? Give feedback.
-
Thank you for the kind answer @EdmTechPhoenix , but as @vloncar says I'm confident my issue isn't related to TorchScript or ONNX. Your answer was however very helpful @vloncar ! I really appreciate it. Following your suggestions I managed to get a small toy model to work without too much trouble. |
Beta Was this translation helpful? Give feedback.
-
Hi! I have a fairly simple network written in PyTorch but it requires several matrix multiplications in the forward pass. As this is not a functionality currently supported, I opted for writing a custom layer simply wrapping a torch.matmul operation using the Extension API. However, this does not seem to work... When trying to convert the model, I still get: "Unsupported function matmul".
Might it be that I lack understanding and it is not possible to do convert a model with a matrix multiplication in the way I intended? Or could the problem be caused by how the symbolic trace works when checking what PyTorch modules the backend supports? The example on the Extension API uses Keras, perhaps using PyTorch introduces problems I was not aware of?
I'm very thankful for any pointers on how to move forward with the issue!
Beta Was this translation helpful? Give feedback.
All reactions