Convert torch.Size([1, 6, 1]) to torch.Size([6])

I have a tensor output that is size torch.Size([1, 6, 1]) that I want to have the final shape of torch.Size([6]). I tried doing output.view(-1,6) but that gives me a tensor of size torch.Size([1, 6]). Could someone help me?

output.squeeze() is exactly what you need.