Optimizing Intermediate Representations of Generative Models for Phase Retrieval