pyro-ppl / pyro

Deep universal probabilistic programming with Python and PyTorch
http://pyro.ai
Apache License 2.0
8.55k stars 987 forks source link

Docs confusion - optimize step twice? #3072

Open ivetasarfyova opened 2 years ago

ivetasarfyova commented 2 years ago

https://github.com/pyro-ppl/pyro/blob/d58b00b3bbce279a976cd8be9d55c88f3654f2e6/pyro/contrib/gp/models/model.py#L64

Hello, there might be something that I'm not seeing, since I'm just now learning how to work with the framework, but I don't understand why there are two separate .step() lines, once called on the svi object and once for the PyTorch optimizer. Shouldn't we be only using one of those, since the svi is supposed to wrap around the PyTorch optimizer? I can't find the declaration for the svi variable above, so I'm not too sure whether I'm thinking about it the right way. Thanks for any help and explanation :)

martinjankowiak commented 2 years ago

@ivetasarfyova this appears to be a typo. afaict the svi.step() is extraneous and should be removed. thanks for reporting!

ivetasarfyova commented 2 years ago

Thank you for such a quick response. In that case, it might be redundant here as well.