Open samgd opened 5 years ago
@samgd Could you create a PR to fix this?
I think that the problem could be resolved by replacing: tf_activations = [tf.nn.tanh]
with: if num_directions == 2: tf_activations = [tf.nn.tanh,tf.nn.tanh] else: tf_activations = [tf.nn.tanh]
Describe the bug
The ONNX LSTM operator states that the
activations
attribute is optional. The LSTM backend implemenation relies on this property being present when using a bidirectional LSTM.The implementation initialises
tf_activations = [tf.nn.tanh]
and only appends an additional activation functionif "activations" in node.attrs:"
andif num_directions == 2:
here:tf_activations
is passed to thernn
method here:The
rnn
method relies on there being a secondactivations
value presentif direction == "bidirectional":
, whereactivations
is thetf_activations
from above here:If the optional attribute is not present, the
activations
list access at this index fails and causes a:To Reproduce
My PyTorch ONNX export seems to include a bunch of strings relating to my environment that I don't want to disclose. Below is a very simple PyTorch script to create an ONNX model that causes this issue: