Approximating Global Contrastive Losses as Optimization over Batch Assignments