How can an AutoGuide be written as a custom guide?

I am interested in understanding how AutoGuides work. Therefore, I would like to see how they can be written as a custom guide explicitly. However, I could not find any resource which covers this topic. For example, how can one implement the custom guide that corresponds to AutoDelta in Gaussian Mixture Model — Pyro Tutorials 1.8.1 documentation?

I would appreciate it if someone could point out a resource or share a code snippet. Thanks in advance!

You could have a look at the source code… you need to ignore a bit of boilerplate and internals but you should be able to see the pattern.

For example, look at this loop and line implementing Autodelta: