For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quantize Modules


function promote_to_qmodule

promote_to_qmodule(
    cls: type[Module]
) → type[QConv1d] | type[QConv2d] | type[QConv3d] | type[QLinear] | None

Convert a torch.nn.Module subclass to its quantized counterpart if exists.

Args:

  • cls (type[torch.nn.Module]): a subclass of a torch.nn.Module

Returns:

  • type[QConv1d] | type[QConv2d] | type[QConv3d] | type[QLinear] | None: a quantized counterpart of the cls if exists. None otherwise.


function enable_quantizers

enable_quantizers(module: Module)None

Enable all fake quantizers in the module.

Args:

  • module (torch.nn.Module): The module containing fake quantizers to enable or disable.


function disable_quantizers

Disable all fake quantizers in the module.

Args:

  • module (torch.nn.Module): The module containing fake quantizers to enable or disable.


Updated: 2024-06-13T23:42:41

Last updated