I've been looking at the pytorch repo. In particular, I'm trying to find where this function is defined:
If you want full vscode search abilities, you can also use this marvelous project : https://github1s.com/pytorch/pytorch
CodePudding user response:
I don't think github has any such functionality and the search function often times doesn't work well for me.
However, depending on the specific case, there are some heuristic methods using the web interface that are quicker than scrolling through the search results.
For example in this case, have a look at the git blame for the line. The commit putting the declaration there should also have put the definition somewhere, usually.
In this case you will get this commit, which by a quick search on the page shows you that there is a macro for explicit specialization definitions of the function template in this file.
I also couldn't find a definition of the primary template with a quick look. Presumably the function is supposed to be explicitly specialized for all types it is used with.
CodePudding user response:
The best way I know is to get a local copy with git clone
and use git grep -n <fn_name>
from the root of the directory (or wherever the source code is stored, either is fine). That will list all instances of the last argument and what file and line number it appears on, so it's typically pretty easy to tell which is the definition because it will have a {
instead of a ;
at the end.