Function Contrastive Learning of Transferable Representations