Thank you very much for your reply. I used my original code with the changes you suggested. I got this error after that.
RuntimeError: Given input size: (128x1x2). Calculated output size: (128x1x0). Output size is too small