Diffusion-Based Representation Learning