I know that the documentation already has the symbols and everything in multiple pages. I am looking for a way to gather all of them quickly so is there a page with all of it?
If what you want is only the list without links. There is a hack way.
import torch
import importlib
import sys
def traversedir(module, pref=''):
for attr in dir(module):
if attr[0] == '_':
continue
if attr not in sys.modules:
fullname = f'{pref}.{attr}'
yield fullname
try:
importlib.import_module(fullname)
for submodule in traversedir(getattr(module, attr), pref=fullname):
yield submodule
except:
continue
if __name__ == "__main__":
for x in traversedir(torch, pref='torch'):
print(x)
Thank you so much @huahuanZ ! I would like to ask is it possible to only get public functions usable from a client? This returns every possible function in PyTorch.
Older versions had single page docs like torch — PyTorch 1.6.0 documentation ; three main pages are “torch”, “Tensor” (object methods) and “torch.nn”, most APIs are still the same.
And there is also “import torch; help(torch)” way