mmdeploy/core/rewriters/rewriter_manager.py
def patch_model(model: nn.Module,
                cfg: Dict,
                backend: str = Backend.DEFAULT.value,
                recursive: bool = True,
                **kwargs) -> nn.Module:
    """Patch the model, replace the modules that can be rewritten.

    Args:
        model (torch.nn.Module): The model to patch.
        cfg (Dict): Config dictionary of deployment.
        backend (str): The inference engine name.
        recursive (bool): The flag to enable recursive patching.

    Returns:
        nn.Module: THe patched model.

    Examples:
        >>> from mmdeploy.core import patch_model
        >>> patched_model = patch_model(model, cfg=deploy_cfg, backend=backend)
    """
    return MODULE_REWRITER.patch_model(model, cfg, backend, recursive,
                                       **kwargs)
Patch the model, replace the modules that can be rewritten.

    Args:
        model (torch.nn.Module): The model to patch.
        cfg (Dict): Config dictionary of deployment.
        backend (str): The inference engine name.
        recursive (bool): The flag to enable recursive patching.

    Returns:
        nn.Module: THe patched model.

    Examples:
        >>> from mmdeploy.core import patch_model
        >>> patched_model = patch_model(model, cfg=deploy_cfg, backend=backend)
    
Patch the model, replace the modules that can be rewritten.
Patch the model replace the modules that can be rewritten .
def patch_model(model: nn.Module,
                cfg: Dict,
                backend: str = Backend.DEFAULT.value,
                recursive: bool = True,
                **kwargs) -> nn.Module:
    return MODULE_REWRITER.patch_model(model, cfg, backend, recursive,
                                       **kwargs)
def patch_model ( model : nn . Module , cfg : Dict , backend : str = Backend . DEFAULT . value , recursive : bool = True , ** kwargs ) -> nn . Module : return MODULE_REWRITER . patch_model ( model , cfg , backend , recursive , ** kwargs )
Patch the model, replace the modules that can be rewritten.
Patch the model replace the modules that can be rewritten .
"""Patch the model, replace the modules that can be rewritten.

    Args:
        model (torch.nn.Module): The model to patch.
        cfg (Dict): Config dictionary of deployment.
        backend (str): The inference engine name.
        recursive (bool): The flag to enable recursive patching.

    Returns:
        nn.Module: THe patched model.

    Examples:
        >>> from mmdeploy.core import patch_model
        >>> patched_model = patch_model(model, cfg=deploy_cfg, backend=backend)
    """
THe patched model.
THe patched model .
nn.Module
model
nn.Module
The model to patch.
The model to patch .
cfg
Dict
Config dictionary of deployment.
Config dictionary of deployment .
backend
str
The inference engine name.
The inference engine name .
recursive
bool
The flag to enable recursive patching.
The flag to enable recursive patching .
examples
>>> from mmdeploy.core import patch_model
>>> patched_model = patch_model(model, cfg=deploy_cfg, backend=backend)
>>> from mmdeploy . core import patch_model >>> patched_model = patch_model ( model cfg = deploy_cfg backend = backend )