yuval-alaluf / SAM

Official Implementation for "Only a Matter of Style: Age Transformation Using a Style-Based Regression Model" (SIGGRAPH 2021) https://arxiv.org/abs/2102.02754
https://yuval-alaluf.github.io/SAM/
MIT License
632 stars 151 forks source link

[code] About the coach.py #42

Closed diaodeyi closed 2 years ago

diaodeyi commented 2 years ago

Hi , thanks for your great work! There are tow loss.backward() in coach.py, is there any need for loss.backward(retain_graph=True)?
Because the Calculation graph will be cleared after backward() by default

yuval-alaluf commented 2 years ago

It is ok that the graph will be cleared after the first forward pass. You perform the forward pass, perform backprop, and then clear the graph. And then you repeat the same thing for the cycle pass.

diaodeyi commented 2 years ago

Thanks