Can I use Dataparallel if my loss is calculated on the whole batch?

Let’s say i have 20 batch and 10 image per batch. (I have some loaded tensors that has to be seen for every image) Would I be able to split my Data into 5-5 image per batch if the loss i am using should be calculated on the results of the 10 image together? Can I use Distributed Dataparalell?