peal.adaptors.clarc.extract_all_children

peal.adaptors.clarc.extract_all_children(model, prefix='')[source]

Flatten nested nn.Sequential containers into a list of leaf children.

Parameters:
  • model (torch.nn.Module) – Model to walk with named_children.

  • prefix (str) – Dotted name prefix used for recursion.

Returns:

Modules in forward order and their dotted names. Only Sequential is descended into; other containers are returned as single children.

Return type:

(list of torch.nn.Module, list of str)