mirror of
https://github.com/luxfhe/ml-sdk.git
synced 2026-10-30 18:13:04 +00:00
Machine Learning with FHE - fork of Zama Concrete-ML - Built-in FHE-friendly ML models - scikit-learn compatible API - PyTorch model conversion - Quantization-aware training
2.8 KiB
2.8 KiB
module concrete.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 encryptioncompression_key: Compression key for encryptionuse_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.