Compiling a recent release version from source

Unfortunately, my driver is no longer supported by the pytorch builds (too old even though the laptop is brand new), so I need to build from source. Also unfortunately, the master branch may have new features or other breaking changes. How do I build a specific release version from source?

You could browse the commits in the repo and checkout a specific one which you would like to build.

All 10,492 of them? Let me rephrase. How would I compile the same code that was used when compiling pytorch 0.3.1?

If you are looking for a specific version, I would search for the label and checkout the last commit.
Here are all labels for 0.3.1.

Is there any straightforward way to determine which branch is the one that was used to build the version that was released?

I found the answer here: