{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Type abbreviations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code and docs sometimes use *type abbreviations* to avoid type signatures getting unwieldy. Here's a list of all abbreviations for composite types for convenient access." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From [`core`](/core.html#core)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- `AnnealFunc` = `Callable`\\[\\[`Number`,`Number`,`float`], `Number`]\n", "- `ArgStar` = `Collection`\\[`Any`]\n", "- `BatchSamples` = `Collection`\\[`Tuple`\\[`Collection`\\[`int`], `int`]]\n", "- `Classes` = `Collection`\\[`Any`]\n", "- `DataFrameOrChunks` = `Union[DataFrame, pd.io.parsers.TextFileReader]`\n", "- `FilePathList` = `Collection`\\[`Path`]\n", "- `Floats` = `Union`\\[`float`, `Collection`\\[`float`]]\n", "- `ImgLabels` = `Collection`\\[`ImgLabel`]\n", "- `KeyFunc` = `Callable`\\[\\[`int`], `int`]\n", "- `KWArgs` = `Dict`\\[`str`,`Any`]\n", "- `ListOrItem` = `Union`\\[`Collection`\\[`Any`],`int`,`float`,`str`]\n", "- `ListRules` = `Collection`\\[`Callable`\\[\\[`str`],`str`]]\n", "- `ListSizes` = `Collection`\\[`Tuple`\\[`int`,`int`]]\n", "- `NPArrayableList` = `Collection`\\[`Union`\\[`np`.`ndarray`, `list`]]\n", "- `NPArrayList` = `Collection`\\[`np`.`ndarray`]\n", "- `OptDataFrame` = `Optional`\\[`DataFrame`]\n", "- `OptListOrItem` = `Optional`\\[`ListOrItem`]\n", "- `OptRange` = `Optional`\\[`Tuple`\\[`float`,`float`]]\n", "- `OptStrTuple` = `Optional`\\[`Tuple`\\[`str`,`str`]]\n", "- `OptStats` = `Optional`\\[`Tuple`\\[`np`.`ndarray`, `np`.`ndarray`]]\n", "- `PathOrStr` = `Union`\\[`Path`,`str`]\n", "- `PBar` = `Union`\\[`MasterBar`, `ProgressBar`]\n", "- `Point`=`Tuple`\\[`float`,`float`]\n", "- `Points`=`Collection`\\[`Point`]\n", "- `Sizes` = `List`\\[`List`\\[`int`]]\n", "- `SplitArrayList` = `List`\\[`Tuple`\\[`np`.`ndarray`,`np`.`ndarray`]]\n", "- `StartOptEnd`=`Union`\\[`float`,`Tuple`\\[`float`,`float`]]\n", "- `StrList` = `Collection`\\[`str`]\n", "- `Tokens` = `Collection`\\[`Collection`\\[`str`]]\n", "- `OptStrList` = `Optional`\\[`StrList`]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From [`torch_core`](/torch_core.html#torch_core)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- `BoolOrTensor` = `Union`\\[`bool`,`Tensor`]\n", "- `FloatOrTensor` = `Union`\\[`float`,`Tensor`]\n", "- `IntOrTensor` = `Union`\\[`int`,`Tensor`]\n", "- `ItemsList` = `Collection`\\[`Union`\\[`Tensor`,[`ItemBase`](/core.html#ItemBase),'`ItemsList`',`float`,`int`]]\n", "- `LambdaFunc` = `Callable`\\[\\[`Tensor`],`Tensor`]\n", "- `LayerFunc` = `Callable`\\[ [[`nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)],`None`]\n", "- [`Model`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) = [`nn`](https://pytorch.org/docs/stable/nn.html#torch-nn).[`Module`](/torch_core.html#Module)\n", "- `ModuleList` = `Collection`\\[[`nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)]\n", "- `OptOptimizer` = `Optional`\\[[`optim.Optimizer`](https://pytorch.org/docs/stable/optim.html#torch.optim.Optimizer)]\n", "- `ParamList` = `Collection`\\[[`nn.Parameter`](https://pytorch.org/docs/stable/nn.html#torch.nn.Parameter)]\n", "- `Rank0Tensor` = `NewType`('`OneEltTensor`', `Tensor`)\n", "- `SplitFunc` = `Callable`\\[[`Model`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)], `List`[`Model`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)]]\n", "- `SplitFuncOrIdxList` = `Union`\\[`Callable`, `Collection`\\[`ModuleList`]]\n", "- `TensorOrNumber` = `Union`\\[`Tensor`,`Number`]\n", "- `TensorOrNumList` = `Collection`\\[`TensorOrNumber`]\n", "- `TensorImageSize` = `Tuple`\\[`int`,`int`,`int`]\n", "- `Tensors` = `Union`\\[`Tensor`, `Collection`\\['`Tensors`']]\n", "- `Weights` = `Dict`\\[`str`,`Tensor`]\n", "- `AffineFunc` = `Callable`\\[\\[`KWArgs`], [`AffineMatrix`](https://pytorch.org/docs/stable/tensors.html#torch-tensor)]\n", "- `HookFunc` = `Callable`\\[[`Model`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module), `Tensors`, `Tensors`], `Any`]\n", "- `LogitTensorImage` = `TensorImage`\n", "- `LossFunction` = `Callable`\\[\\[`Tensor`, `Tensor`], `Rank0Tensor`]\n", "- `MetricFunc` = `Callable`\\[\\[`Tensor`,`Tensor`],`TensorOrNumber`]\n", "- `MetricFuncList` = `Collection`\\[`MetricFunc`]\n", "- `MetricsList` = `Collection`\\[`TensorOrNumber`]\n", "- `OptLossFunc` = `Optional`\\[`LossFunction`]\n", "- `OptMetrics` = `Optional`\\[`MetricsList`]\n", "- `OptSplitFunc` = `Optional`\\[`SplitFunc`]\n", "- `PixelFunc` = `Callable`\\[\\[`TensorImage`, `ArgStar`, `KWArgs`], `TensorImage`]\n", "- `CoordFunc` = `Callable`\\[[`FlowField`](/vision.image.html#FlowField), `TensorImageSize`, `ArgStar`, `KWArgs`], `LogitTensorImage`]\n", "- `LightingFunc` = `Callable`\\[\\[`LogitTensorImage`, `ArgStar`, `KWArgs`], `LogitTensorImage`]" ] } ], "metadata": { "jekyll": { "keywords": "fastai", "summary": "Type annotations names", "title": "fastai_typing" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" } }, "nbformat": 4, "nbformat_minor": 2 }