The error occurs at

torch.cat([mean_std_features,label_vector],dim=1))

From the error trace, I would guess the shapes are (batch_size,something) for label vector and (1,something) for mean_std_features. This implies that the the mean_std() is agnostic to changes in batch size. You would have to change the function to accomodate for different batch sizes. First, do verify this by printing out the shapes of the variables in question. Once you confirm, try tweaking the mean_std() to accmodate different batch sizes.