you can reduce output of loss function yourself  or use reduction='sum'   instead of reduction='mean'. this way your orverall loss is proportional to number of samples in each batchs.
CrossEntropyLoss:



reduction (string , optional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the weighted mean of the output is taken, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'