GPT-4 is just really good at code. We documented some of the examples that we found were crazy amazing and worth hackernews. Including GPT-4's ability to handle bazel, kube, terraform and rust. A summary can be found on this thread: https://twitter.com/sualehasif996/status/1635755267739598848
The commenting was for the model to learn what the types were so it could translate it to gather. Doing that one shot is surprising to me because it is somewhat hard to get pytorch tensors to work out to the correct shapes.
If you have access, the repo should be fairly replicable.