Flatten 3D tensor
I have a tensor of the shape T x B x N (training data for a RNN, T is max seq length, B is number of batches, and N number of features) and I'd like to flatten all the features across timesteps, such that I get a tensor of the shape B x TN. Haven't been able to figure out how to do this..

You need to permute your axes before flattening, like so:
t = t.swapdims(0,1) # (T,B,N) -&gt; (B,T,N)
t = t.view(B,-1)    # (B,T,N) -&gt; (B,T*N) (equivalent to `t.view(B,T*N)`)

