quantized
27 memberslucid.nn.quantizedlucid.nn.quantized — quantized inference modules.
The int8-weight counterparts of the float lucid.nn layers, produced by
lucid.quantization.convert from a calibrated model. Under the
sidecar representation (design B) they store int8 weights + scale /
zero_point buffers and compute in float (dequantize → op →
fake-quantize). QuantizedLinearMLX is the exception and runs
the engine's own low-precision GEMM instead; the two agree to 5e-07,
which is what makes the float path a usable reference for it.
Also holds the boundary markers QuantStub / DeQuantStub placed in a
float model and their runtime forms Quantize / DeQuantize.
Sub-packages
Classes
ELU2 methodsQuantized lucid.nn.ELU — elu(x, alpha) then output fake-quant.
Hardsigmoid2 methodsQuantized lucid.nn.Hardsigmoid — hardsigmoid(x) then fake-quant.
Hardswish2 methodsQuantized lucid.nn.Hardswish — hardswish(x) then output fake-quant.
LeakyReLU2 methodsQuantized lucid.nn.LeakyReLU — leaky_relu(x, slope) then fake-quant.
Sigmoid2 methodsQuantized lucid.nn.Sigmoid — sigmoid(x) then output fake-quant.
Tanh2 methodsQuantized lucid.nn.Tanh — tanh(x) then output fake-quant.
Conv1d3 methodsQuantized 1-D convolution — int8 kernel, dequantize-to-float compute.
Conv2d3 methodsQuantized 2-D convolution — int8 kernel, dequantize-to-float compute.
Conv3d3 methodsQuantized 3-D convolution — int8 kernel, dequantize-to-float compute.
ConvTranspose1d3 methodsQuantized 1-D transposed (fractionally-strided) convolution.
ConvTranspose2d3 methodsQuantized 2-D transposed (fractionally-strided) convolution.
ConvTranspose3d3 methodsQuantized 3-D transposed (fractionally-strided) convolution.
FloatFunctional6 methodsFloat-domain quantizable merge ops whose output prepare observes.
QFunctional7 methodsQuantized element-wise merges — each result fake-quantized to one grid.
ConvReLU1d1 methodsQuantized 1-D convolution with a fused ReLU — int8 kernel, float compute.
ConvReLU2d1 methodsQuantized 2-D convolution with a fused ReLU — int8 kernel, float compute.
ConvReLU3d1 methodsQuantized 3-D convolution with a fused ReLU — int8 kernel, float compute.
LinearReLU1 methodsQuantized linear layer with a fused ReLU — int8 weight, float compute.
Linear4 methodsQuantized linear (fully-connected) layer — int8 weight, float compute.
QuantizedLinearMLX4 methodsWeight-only int4/int8 linear backed by a real Metal low-precision GEMM.
DeQuantize2 methodsRuntime exit from the quantized region — identity under design B.
DeQuantStub2 methodsQuantized→float boundary marker — the exit stub of a quantizable model.
Quantize2 methodsRuntime entry into the quantized region — fake-quantizes the input.
QuantStub2 methodsFloat→quantized boundary marker — the entry stub of a quantizable model.
QuantWrapper2 methodsWrap an arbitrary float model with QuantStub / DeQuantStub.
Embedding4 methodsQuantized embedding lookup table — per-row int8, dequantize-on-lookup.
EmbeddingBag4 methodsQuantized EmbeddingBag — per-row int8 table, pooled dequant lookup.