Files
torus-ml/docs/references/api/torus.ml.quantization.linear_op_glwe_backend.md
zeekay e037e8f7ea torus: one name for the package, and it is ours
The distribution called itself torus-ml while shipping a package directory
named concrete, so the name a user installs and the name they import disagreed
— and most of the tree already said torus.ml, which could not resolve against
src/concrete. Moved src/concrete to src/torus and pointed the include at it.

The dependency was Zama's concrete-python from their index. It is torus-fhe
from ours, which is what luxfhe/torus already ships: that frontend declares
torus-fhe and ships a torus/fhe module, so every 'from torus.fhe' in this tree
was already naming our compiler and only the dependency lagged.

Two distributions share one namespace, which is the shape the upstream this
forked from used and the reason the split works: torus-fhe gives torus.fhe,
torus-ml gives torus.ml.

Swept every other spelling — identifiers, enum members, workflow variables,
filenames, notebooks. LICENSE and NOTICE keep the upstream attribution a fork
owes; the figures carry the old name in JPEG metadata a text sweep cannot
reach.
2026-08-27 13:20:50 -07:00

2.8 KiB

module torus.ml.quantization.linear_op_glwe_backend

GLWE backend for some supported layers.


function has_glwe_backend

has_glwe_backend()

Check if the GLWE backend is installed.

Returns:

  • bool: True if the GLWE backend is installed, False otherwise.

class GLWELinearLayerExecutor

GLWE execution helper for pure linear layers.

method __init__

__init__(
    private_key=None,
    compression_key=None,
    use_dynamic_quantization: bool = True
)

Initialize the GLWE linear layer executor.

Args:

  • private_key: Private key for encryption
  • compression_key: Compression key for encryption
  • use_dynamic_quantization: Whether to use dynamic quantization

method forward

forward(x: Tensor, q_module: QuantizedModule, fhe: HybridFHEMode) → Tensor

Perform the inference of this linear layer.

Args:

  • x (torch.Tensor): Input or previous layer activations.
  • q_module (QuantizedModule): Module containing the quantized layer.
  • fhe (HybridFHEMode): Execution mode, can be 'DISABLE' or 'EXECUTE'.

Returns:

  • torch.Tensor: The result of applying the linear layer.

method keygen

keygen()

Generate private and compression key.