On the Generalization of Diffusion Model