Is there a way to get all Pytorch Python API symbols?

Hello, a new user of Pytorch here, is there a place that contains all PyTorch symbols similarly to Tensorflow? Example: https://www.tensorflow.org/api_docs/python/tf/all_symbols

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)

1 Like

Thank you so much @David_Harvey ! I would like to ask is it possible to only get public functions usable from a client? This returns every possible function in PyTorch.

What do you mean “public functions” ?

I have filtered out those module/attribute names start with underscore.

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

1 Like

What I mean by public functions are the ones invokable from a client like what the last post said. torch.nn and etc

May this link Index — PyTorch 1.10 documentation be helpful