This module contains all the basic functions we need in other modules of the fastai library (split with
core that contains the ones not requiring pytorch). Its documentation can easily be skipped at a first read, unless you want to know what a given fuction does.
default_device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
Flattens all the layers of
b is None, returns the
requires_grad state of the first layer of
m. Otherwise, sets
requires_grad=b in all children of
x is a torch
Put the input of the batch
b in half precision.
x to a numpy array.
model according to the layer in
splits are layers, the model is split at those (not included) sequentially. If
want_idxs is True, the corresponding indexes are returned. If
splits are lists of layers, the model is split according to those.