Fastest way to determine backwards compatibility of an operation?

I frequently run into the problem of figuring out which versions of torch some function or layer like nn.tanh or torch.bool was introduced in. My current way of doing it is guessing and then searching through release notes on github. Is there a faster way?

git blame might be another option to see the last PR(s) for a method or searching the docs for each release version.
May I ask what your use case is to look for the first release version?

Adding to @ptrblck, you can go to the source code in git hub and then click on blame button and then scroll down to the implementation of the functionality and you should see the history from its creation. I can’t think of any better way than this.

Use Case: Reviewing code for the transformers, where we are trying to maintain backwards compatibility with version >= 1.0.0, but our CI tests run in 1.4, so we have to manually check against breaking the backwards compatibility promise.

The git blame idea inspired me to write a script that you can add to your .bashrc/.zshrc/.bash_profile:

_checkout_grep() {  # helper fn
	git checkout $1 > /dev/null 2>&1  # surpress Previous HEAD position msg
	git grep $2 | wc -l
}

check_torch_compat () {
	# check the pytorch compatibility of a function
	# example usage check_torch_compat torch.bool, TODO: For loop
	cd ~/pytorch/docs
	echo "1.0"
	_checkout_grep v1.0.0 $1
	echo "1.1"
	_checkout_grep v1.1.0 $1
	echo "1.2"
	_checkout_grep v1.2.0 $1
	echo "1.3"
	_checkout_grep v1.3.0 $1
	echo "1.4"
	_checkout_grep v1.4.0 $1
	echo "master"
	_checkout_grep master $1
	cd -  > /dev/null 2>&1
}

Output for check_torch_compat torch.bool is below. (you have to clone the repo and put it at ~ or update the bash code with your repo path).
(0 in output means torch.bool is not in that version)
image

The best non-scripted solution I’ve heard is manipulating the URL in https://pytorch.org/docs/1.0.0/nn.html + cmd-f. for the function name.

That would be one approach, but I think it might be a flaky one as your CI seems to be only checking for the definition of these functions.
While you could probably make sure that the code is at least executable, you cannot give any guarantee that it’s indeed working.