Message Boards Message Boards

0
|
132 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Can recurrent layers be exported to ONNX?

Posted 12 days ago

If I include BasicRecurrentLayer, GatedRecurrentLayer, etc in a net, exporting to ONNX doesn't fail, but if I try to load it with ONNX Runtime Web, the session fails to initialize.

ONNX Runtime Web doesn't throw exceptions when initializing networks that have no recurrent layers, but when there are some, it throws numbers (instead of Error objects) that don't correspond to any error codes that I have been able to look up.

I would suspect the ONNX runtime, but issues like this one in Microsoft's tracker suggest that ONNX has no way to maintain internal state in the way that recurrent networks need to do, so I wonder if Wolfram Language is exporting a valid ONNX file in the first place?

Example WL:

NetChain[
 {UnitVectorLayer[], BasicRecurrentLayer[32], SequenceLastLayer[], 
  LinearLayer[27], SoftmaxLayer[]},
 "Input" -> NetEncoder["Characters"],
 "Output" -> 
  NetDecoder[{"Class", Characters["abcdefghijklmnopqrstuvwxyz "]}]
 ]
Export["lm.onnx", NetInitialize[%]]
POSTED BY: Tom Lieber
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract