Skip to content

ActiveWordLogPlan

from tensorsig.offset_coded_signatures.active_word_log import ActiveWordLogPlan

One factor state and its fixed log/quotient readout.

state_count property

state_count: int

Number of factor-closed signature coordinates, including the scalar.

to

to(device: device, dtype: dtype) -> ActiveWordLogPlan

Bind the immutable state/readout coefficients, reusing prior bindings.

Source code in src/tensorsig/offset_coded_signatures/active_word_log.py
def to(self, device: torch.device, dtype: torch.dtype) -> ActiveWordLogPlan:
    """Bind the immutable state/readout coefficients, reusing prior bindings."""
    device = torch.device(device)
    if (
        device == self.quotient_matrix.device
        and dtype == self.quotient_matrix.dtype
    ):
        return self
    key = (device, dtype)
    if key not in self._bound:
        self._bound[key] = ActiveWordLogPlan(
            self.program.to(device, dtype),
            self.log_readout.to(device, dtype),
            self.quotient_matrix.to(device=device, dtype=dtype),
            self.requested_words,
        )
    return self._bound[key]

readout

readout(state: Tensor) -> Tensor

Map factor-state signatures to the plan's ordered quotient coordinates.

Source code in src/tensorsig/offset_coded_signatures/active_word_log.py
def readout(self, state: Tensor) -> Tensor:
    """Map factor-state signatures to the plan's ordered quotient coordinates."""
    return self.log_readout(state) @ self.quotient_matrix.T