This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
Different outputs between pytorch, onnx and coreml #576
Labels
bug
Unexpected behaviour that should be corrected (type)
🐞Describe the bug
I'm training a neural network containing an embedding layer, a linear layer, a GRU, then followed with another linear and a logsoftmax. It's trained properly and exported as well to onnx and coreml. However, when I test (that is, computing a forward step with a dummy input) the three models (.pth, .onnx and .mlmodel), the pytorch and onnx models yield the same output but the coreml doesn't.
Trace
This is what happens when I compare the pytorch output vs the coreml output:
Unfortunately I can't attach the models since they belong to my company.
System environment (please complete the following information):
Additional context
I deleted the GRU and adapted a bit the network and everything works out, so I guess there's an issue with it. The network receives as input also the initial hidden state. Also, the batch_first flag is set to false.
UPDATE
Ok so I simplified (a lot) the network and came up with the following script, which has the same issue I described above:
Regarding this line:
I'm not sure if it makes sense to use an input of type Float, since the first layer is and embedding layer, but couldn't figure out the way to use a Long input in coreml.
UPDATE 2
As I said, if you remove the GRU everything goes well, that is, changing the network to:
The text was updated successfully, but these errors were encountered: