I think you are not passing in the right shapes - RNNs expect a seq x batch x feature input and output something of that shape (with the number of features potentially different). The hidden state would be batch x num_hidden (or a tuple of two things).
Bidirectional RNNs double output features and num_hidden.



 Maverobot:

I am pretty new to libtorch and pytorch in general. …  It would be nice if someone could help me out.


We all started somewhere, but yes, it may be wise to follow one of the RNN-based tutorials, e.g. Name generation one 11.
Given that the C++ library follows the Python one so closely, the Python tutorials are applicable here.
Best regards
Thomas