import torchEvery framework has thousands of functions and classes. You won’t memorize them — you’ll look them up.
Two Python builtins do most of the work:
dir(module) — what’s in here?help(thing) (or ?thing in Jupyter) — how do I use it?Plus the official docs: pytorch.org, jax.dev, tensorflow.org, mxnet.apache.org.
dir: discovering the APIStandard import:
dir(...) lists names in a module. Filter private names and show a small prefix on slides; in a notebook you can inspect the full list interactively:
['AbsTransform', 'AffineTransform', 'Bernoulli', 'Beta', 'Binomial', 'CatTransform', 'Categorical', 'Cauchy', 'Chi2', 'ComposeTransform', ...
help: usage detailsOnce you have the name, help(...) prints the docstring with arguments, defaults, and a usage example:
Help on built-in function ones in module torch:
ones(...)
ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor
Returns a tensor filled with the scalar value `1`, with the shape defined
...
>>> torch.ones(2, 3)
tensor([[ 1., 1., 1.],
[ 1., 1., 1.]])
>>> torch.ones(5)
tensor([ 1., 1., 1., 1., 1.])
dir(module) — list contents.help(symbol) (or symbol? in Jupyter) — show the docstring.Tab) is your fastest discovery tool.