Hi,
The input to a pytorch LSTM layer (nn.LSTM) has to be an input with shape (sequence length, batch, input_size). So you will likely have to reshape your input sequence to be of the shape (10, 1, 512*7*7) which you can do with - x = x.view(10,1,512*7*7).
You can do the following after that-
model = nn.LSTM(input_size = 512*7*7, hidden_size = 512*7*7)
out, (h,c) = model(x)

Where h is the many-to-one output you need. It will have the shape (1,1,512*7*7).
Hope this helps.