squeeze does not allow me to work on dim != 1 so I chose a store them in the beginning and restore later approach.