NoopObserver
PlaceholderObserverNoopObserver(qscheme: QScheme = per_tensor_affine, qdtype: QDtype = quint8, eps: float = 1e-08)A no-op PlaceholderObserver — pure identity, collects no statistics.
The intent-revealing name for a PlaceholderObserver: a tensor should flow
through the observed graph without any statistic gathering at all. Whereas a bare
PlaceholderObserver reads as "qparams come from elsewhere (dynamic quant)",
NoopObserver reads as "this tensor is deliberately not quantized here" — an
already-quantized input, a residual passed straight through, or a layer explicitly
excluded from calibration. Behaviourally the two are identical: forward is the
identity and calculate_qparams raises. Only the name (and the reader's
intent) differs.
When to pick it. Use it to annotate a passthrough tensor in a QConfig / mapping
so the tooling records the "leave alone" intent explicitly rather than by omission.
When qparams really are produced at runtime, prefer PlaceholderObserver;
when a fixed grid is known, use FixedQParamsObserver.
Like its parent it holds no statistic and its qparams query is an error:
Parameters
Notes
- Pure alias. Inherits the
qscheme/qdtype/epsconstructor and all behaviour ofPlaceholderObserverunchanged; it overrides nothing. - Identity forward, raising qparams — same contract as the parent; the class exists to make "no observation" a first-class, greppable choice.
- No buffers, so nothing is added to the
state_dictbeyond the metadata.
Examples
>>> import lucid
>>> import lucid.quantization as Q
>>> obs = Q.NoopObserver()
>>> x = lucid.randn(2, 3)
>>> bool((obs(x) == x).all().item()) # identity passthrough
True
>>> isinstance(obs, Q.PlaceholderObserver) # it *is* a PlaceholderObserver
TrueSee Also
- lucid.quantization.PlaceholderObserver—The parent — dtype carrier, qparams raise.
- lucid.quantization.FixedQParamsObserver—Fixed qparams for range-bounded ops.
- lucid.quantization.MinMaxObserver—Statistics-collecting observer for static ranges.
- lucid.quantization.FakeQuantize—Wraps an observer for QAT.