Quantized→float boundary marker — the exit stub of a quantizable model.
The exit-side counterpart of QuantStub: place it where the
quantized region ends and ordinary float compute resumes. Like its
entry-side twin it is a placeholder — an identity at float / calibration
time whose only job is to give the tooling a named site — and
lucid.quantization.convert swaps it for a runtime
DeQuantize.
Under Lucid's sidecar representation (design B) activations are carried as
(fake-quantized) float32 throughout the quantized region rather than as
packed integer tensors, so "dequantizing" the exit is a no-op: there is no
integer buffer to unpack back to float. The marker therefore never changes a
tensor's values in either its stub or its converted form — it exists purely
so the quantized graph is symmetric and walkable by tooling.
Parameters
qconfigobject= NoneNone (the
default) no qconfig attribute is set and the module inherits the
surrounding model's config during prepare / convert.Notes
- Holds no state and takes no runtime tensor arguments beyond the input.
- Because activations stay float-carried, a model may omit
DeQuantStubentirely and still produce correct numerics; it is kept for graph symmetry and to mark intent. - Converts to
DeQuantize, which is likewise a pure identity — so a quantized region is bracketed by exactly one active boundary (Quantizeon entry).
Examples
>>> import lucid, lucid.nn as nn
>>> dq = nn.quantized.DeQuantStub()
>>> x = lucid.randn(2, 3)
>>> bool((dq(x) == x).all().item()) # identity in every mode
TrueSee Also
- lucid.nn.quantized.QuantStub—The matching entry-side boundary marker.
- lucid.nn.quantized.DeQuantize—The runtime form this stub converts into.
- lucid.nn.quantized.QuantWrapper—Wraps a model in a stub pair.