Since the flattened dimensions are consecutive, the elements won’t be mixed.
Here is a small example to show what the operation is doing:
batch_size, bag_size, num_channels, height, width = 2, 3, 2, 2, 2
x = torch.arange(batch_size*bag_size*num_channels*height*width).view(
    batch_size, bag_size, num_channels, height, width)
print(x)
x = x.view(-1, num_channels, height, width)
print(x)