Based on the error message it seems you are trying to calculate the log_softmax inside the criterion in dim1 (which is the standard and right approach for a multi-class classification), but your tensor has only a single dimension.
Could you remove the squeeze() operation in loss = criterion(output.squeeze(), ...) and check, if it’s working, since this op would remove all dimensions with a size==1?