def get_center_of_mass(centers_of_mass, masses):
    """Determine the center of mass of a set of objects

    Args
        centers_of_mass [*shape, num_objects, 2]
        masses [*shape, num_objects]

    Returns [*shape, 2]
    """
    return (centers_of_mass * masses[..., None]).sum(-2) / masses.sum(-1)[..., None]