Oh, sorry I though you had 8 classes 
Okay let’s pose it
You have a batch size 8 and your output is a single number, thus you get a 8x1 vector, That’s fine.
The problem could be about how you set the dataloader. Are you using the torch dataloader?
If so, it automatically creates batches.
in the getitem you should return a tensor with a single number (your ground truth in fact) of size [].
So I guess the problem is when pytorch generates the batch you are getting a tensor of size [batch]
This happens because a tensor of a number has no dimensions. To fix it you have to unsqueeze that tensor in getitem
Check this
import torch

a=torch.tensor(11)

a.size()
Out[3]: torch.Size([])

a=a.unsqueeze(0)

a.size()
Out[5]: torch.Size([1])

This way, when the dataloader loads a batch, you will get a tensor of size batchx1 which is what you need to match your output.
The best you can do is to run the dataloader until your batches has that desired shape