Learning Task Representations from In-Context Learning