Traced RNN model always gives EXACT same output from LibTorch (C++)

I’ve successfully used torch.jit.trace to export 2 of my Conv models to C++ (using LibTorch), and they both work perfectly. Now I’m trying to do the same with my third model, which is an RNN (BiDirectional LSTM), and it always gives the EXACT same output from my C++ code. No matter what inputs I give it, I always get the exact same output.
Any ideas what’s going on here? Is there some kind of special initialization/reset that one has to do on an RNN model from C++?

In my original question, I was using PyTorch v1.0.1.

Now, I just built PyTorch/LibTorch from latest master (2019-03-02), and it WORKS!

So PSA: Don’t try using RNNs from LibTorch on v1.0.1 branch. Build off master instead.

1 Like