Hi Adrian,
This will not be a good answer to your question, but I was looking for something similar and had basically the same set of questions.
I found this dropout.py 226
It is a couple years old, but has the code. It is sitting under torch/nn/_functions
Its not there in the current repository. I wonder if it has something to do with the refactoring they did that moved state to ‘the graph’. Just a guess. Post if you find the current location!