Containers#

Sequential#

class Sequential(*args):

A sequential container.

Modules will be added to it in the order they are passed in the constructor.

Methods#

forward#

def forward(self, x):

ModuleList#

class ModuleList(modules: 'list[Module] | None' = None):

Holds submodules in a list.

ModuleList can be indexed like a regular Python list, but modules it contains are properly registered, and will be visible by all Module methods.

Methods#

append#

def append(self, module: 'Module') -> 'None':

forward#

def forward(self, *args, **kwargs):

ModuleDict#

class ModuleDict(modules: 'dict[str, Module] | None' = None):

Holds submodules in a dictionary.

ModuleDict can be indexed like a regular Python dictionary, but modules it contains are properly registered, and will be visible by all Module methods.

Methods#

forward#

def forward(self, *args, **kwargs):

items#

def items(self):

keys#

def keys(self):

values#

def values(self):