dgs.utils.torchtools.get_model_from_module

dgs.utils.torchtools.get_model_from_module(module: TorchMod | BaseMod) TorchMod[source]

Given either a torch module or an instance of BaseModule, return a torch module. Within a BaseModule, this function searches for a ‘module’ attribute.

Parameters:

module – The module containing or being a torch module.

Returns:

An instance of a torch module.

Raises:

ValueError if a torch module cannot be found.