git clone --depth 1 --branch <tag_name> <repo_url>
--depth 1
is optional but if you only need the state at that one revision, you probably want to skip downloading all the history up to that revision.
git clone --recursive --branch v0.3.1 https://github.com/pytorch/pytorch.git