Overview of the core modules

Core modules of fastai

The basic foundations needed in several parts of the library are provided by these modules:


This module defines the basic DataBunch class which is what will be needed to create a Learner object with a model. It also defines the DeviceDataLoader, a class that wraps a pytorch DataLoader to put batches on the right device.


This module contains the definitions of basic custom layers we need in most of our models, as well as a few helper functions to create simple blocks.

Most of the documentation of the following two modules can be skipped at a first read, unless you specifically want to know what a certain function is doing.


This module contains the most basic functions and imports, notably:

  • pandas as pd
  • numpy as np
  • matplotlib.pyplot as plt


This module contains the most basic functions and imports that use pytorch. We follow pytorch naming conventions, mainly:

  • torch.nn as nn
  • torch.optim as optim
  • torch.nn.functional as F


Core modules are designed to be in conjuction with application specific modules and imported automatically in those cases.

To import core functionality only:

from fastai.basics import *