Skip to content
fn

get_default_qat_qconfig_mapping

→QConfigMapping
get_default_qat_qconfig_mapping()

Build the default QAT QConfigMapping.

Convenience constructor returning a fresh mapping whose global tier is get_default_qat_qconfig and whose per-type / per-name tiers are empty. Every eligible module therefore trains with lucid.quantization.FakeQuantize on its activations and weights unless you add an override. This is the mapping lucid.quantization.prepare_qat uses when called without an explicit one.

Returns

QConfigMapping

A mapping whose global QConfig is the default QAT config and whose type / name tiers are empty (ready to receive overrides).

Notes

  • Add exceptions with QConfigMapping.set_object_type / QConfigMapping.set_module_name; mapping a module to None trains it in float (no fake-quant inserted).
  • For static post-training quantization use get_default_qconfig_mapping instead — it installs bare observers rather than fake-quant modules.

Examples

>>> import lucid.nn as nn
>>> import lucid.quantization as Q
>>> mapping = Q.get_default_qat_qconfig_mapping()
>>> type(mapping.get_qconfig(nn.Linear, "fc").activation()).__name__
'FakeQuantize'

See Also

  • get_default_qat_qconfig—The recipe installed as the global tier.
  • get_default_qconfig_mapping—The static-PTQ counterpart.
  • QConfigMapping—The three-tier resolution object this returns.

Used by 2