Imports

Introduction

To support interactive computing, fastai provides easy access to commonly-used external modules. A star import such as:

  1. from fastai.basics import *

will populate the current namespace with these external modules in addition to fastai-specific functions and variables. This page documents these convenience imports, which are defined in fastai.imports.

Note: since this document was manually created, it could be outdated by the time you read it. To get the up-to-date listing of imports, use:

  1. python -c 'a = set([*vars().keys(), "a"]); from fastai.basics import *; print(*sorted(set(vars().keys())-a), sep="n")'

Names in bold are modules. If an object was aliased during its import, the original name is listed in parentheses.

NameDescription
csvCSV file reading and writing
gcGarbage collector interface
gzipSupport for gzip files
osMiscellaneous operating system interfaces
picklePython object serialization
shutilHigh level file operations
sysSystem-specific parameters and functions
warnings, warnWarning control
yamlYAML parser and emitter
io, BufferedWriter, BytesIOCore tools for working with streams
subprocessSubprocess management
mathMathematical functions
plt (matplotlib.pyplot)MATLAB-like plotting framework
np (numpy) , array, cos, exp,
log, sin, tan, tanh
Multi-dimensional arrays, mathematical functions
pd (pandas), Series, DataFrameData structures and tools for data analysis
randomGenerate pseudo-random numbers
scipy.statsStatistical functions
scipy.specialSpecial functions
abstractmethod, abstractpropertyAbstract base classes
collections, Counter, defaultdict,
namedtuple, OrderedDict
Container datatypes
abc (collections.abc), IterableAbstract base classes for containers
hashlibSecure hashes and message digests
itertoolsFunctions creating iterators for efficient looping
jsonJSON encoder and decoder
operator, attrgetter, itemgetterStandard operators as functions
pathlib, PathObject-oriented filesystem paths
mimetypesMap filenames to MIME types
inspectInspect live objects
typing, Any, AnyStr, Callable,
Collection, Dict, Hashable, Iterator,
List, Mapping, NewType, Optional,
Sequence, Tuple, TypeVar, Union
Support for type hints
functools, partial, reduceHigher-order functions and operations on callable objects
importlibThe implementatin of import
weakrefWeak references
htmlHyperText Markup Language support
reRegular expression operations
requestsHTTP for Humans™
tarfileRead and write tar archive files
numbers, NumberNumeric abstract base classes
tempfileGenerate temporary files and directories
concurrent, ProcessPoolExecutor,
ThreadPoolExecutor
Launch parallel tasks
copy, deepcopyShallow and deep copy operation
dataclass, field, InitVarData Classes
Enum, IntEnumSupport for enumerations
set_traceThe Python debugger
patches (matplotlib.patches), Patch?
patheffects (matplotlib.patheffects)?
contextmanagerUtilities for with-statement contexts
MasterBar, master_bar, ProgressBar,
progress_bar
Simple and flexible progress bar for Jupyter Notebook and console
pkg_resourcesPackage discovery and resource access
SimpleNamespaceDynamic type creation and names for built-in types
torch, as_tensor, ByteTensor,
DoubleTensor, FloatTensor, HalfTensor,
LongTensor, ShortTensor, Tensor
Tensor computation and deep learning
nn (torch.nn), weight_norm, spectral_normNeural networks with PyTorch
F (torch.nn.functional)PyTorch functional interface
optim (torch.optim)Optimization algorithms in PyTorch
BatchSampler, DataLoader, Dataset,
Sampler, TensorDataset
PyTorch data utils

Company logo

©2021 fast.ai. All rights reserved.
Site last generated: Jan 5, 2021