By-default Pytorch nn.Modules requires the first dimension to be the batch.
In case of an RGB image a single sample is of the size [R,G,B]xW,H. The input by default requires an additional dimension so that it becomes Nx3xWxH.
In general any model is designed this way. Increasing your batch size is nothing but making N=8.
This concatanation step is automatically done by the dataloader. If you are using pytorch dataloader you just need to change the batch_size argument.
WRT optimizers, optimizers iterate over model parameters you passed.
If you use a single optimizer it will iterate over everything, it will detect that gradients of non-used branch are none and that’s all. But it still uses time to iterate over all the parameters.
Using several optimizers will iterate over the which you actually know contain gradients. I don’t really know how many time you can save by doing this. Indeed, you would need to extend the logic of the forward pass.
So the normal way would be:
optimizer = OPTIM(model.parameters())
optimizer.zero_grad()
output=model(input)
loss = criterion(output,gt)
loss.backward()
optimizer.step()

It would become something like:
optimizer1 = OPTIM(branch1.parameters())
optimizer2 = OPTIM(branch2.parameters())
output=model(input)
loss = criterion(output,gt)
if x has PA view but not L view:
    optimizer1.zero_grad()
    loss.backward()
    optimizer1.step()
elif x has PA view but not L view:
    optimizer2.zero_grad()
    loss.backward()
    optimizer2.step()

But i don’t know how many time would you save.
If you find it confusing just don’t do it.