Skip to content
class

LSTMCell

extendsLSTMCell]
LSTMCell(shell: nn.Module)

int8-weight LSTM cell built from a float lucid.nn.LSTMCell.

weight_ih / weight_hh are stored int8 per-row symmetric (weight_ih_int8, weight_ih_scale), the biases stay float, and a float nn.LSTMCell shell runs one step on the dequantized weights. Built by lucid.quantization.quantize_dynamic.

Parameters

The float cell whose configuration and arithmetic are reused.

Used by 1

Class methods

1
cls

from_float

→Selffrom _DynamicRecurrent
from_float(mod: nn.Module, dtype: QDtype = qint8)

Quantize a float recurrent module's weights to int8 (no calibration).

mod must be the float type the layer runs — an nn.LSTM for LSTM, an nn.GRUCell for GRUCell.

Instance methods

2
fn

extra_repr

→strfrom _DynamicRecurrent
extra_repr()

Override to add extra repr info (e.g. Linear shows in_features, etc.).

fn

forward

→tuple[Tensor, Tensor]
forward(input: Tensor, hx: tuple[Tensor, Tensor] | None = None)

Inject dequantized weights into the shell and run one step.