nnrl/optim/utils.py
def link_optimizer(cls: Type[Optimizer], module: nn.Module, config: dict) -> Optimizer:
    """Construct optimizer tied to a module.

    Args:
        cls: the type of the optimizer
        module: the neural network module
        config: options to pass to the optimizer's constructor

    Returns:
        The optimizer instance
    """
    if issubclass(cls, (EKFAC, KFAC)):
        return cls(module, **config)
    return cls(module.parameters(), **config)
Construct optimizer tied to a module.

    Args:
        cls: the type of the optimizer
        module: the neural network module
        config: options to pass to the optimizer's constructor

    Returns:
        The optimizer instance
    
Construct optimizer tied to a module.
Construct optimizer tied to a module .
def link_optimizer(cls: Type[Optimizer], module: nn.Module, config: dict) -> Optimizer:
    if issubclass(cls, (EKFAC, KFAC)):
        return cls(module, **config)
    return cls(module.parameters(), **config)
def link_optimizer ( cls : Type [ Optimizer ] , module : nn . Module , config : dict ) -> Optimizer : if issubclass ( cls , ( EKFAC , KFAC ) ) : return cls ( module , ** config ) return cls ( module . parameters ( ) , ** config )
Construct optimizer tied to a module.
Construct optimizer tied to a module .
"""Construct optimizer tied to a module.

    Args:
        cls: the type of the optimizer
        module: the neural network module
        config: options to pass to the optimizer's constructor

    Returns:
        The optimizer instance
    """
The optimizer instance
The optimizer instance
cls
Type[Optimizer]
the type of the optimizer
the type of the optimizer
module
nn.Module
the neural network module
the neural network module
config
dict
options to pass to the optimizer's constructor
options to pass to the optimizer ' s constructor