The MLIR dialect, its conversion passes (TFHEToConcrete, ConcreteToCAPI, ConcreteToLLVM), the optimizer component, the compiler binary, the Rust crate and the program_info parameter file all still carried the upstream project's name. They now carry this one's. Two things deliberately keep the word, because in them it is not the name. mlir::OpTrait CRTP parameters mean "the derived type", so they are spelled Derived and OpTy — LLVM's other conventional spelling for the same idiom. concreteShape is a capnp field: renaming it would change the serialized protocol, and the prose describing it is ordinary English. This also repairs references the earlier partial rename left dangling: Security.cpp included concrete/curves.gen.h and the directory is torus/, torus-cpu.h included concrete-num_complex.h, the Torus dialect CMakeLists named ConcreteOps.td, and compiler/setup.py asked find_namespace_packages for a "concrete" package that no longer exists — so it built without the package it ships.
6.0 KiB
module torus.fhe.compilation.client
Declaration of Client class.
class Client
Client class, which can be used to manage keys, encrypt arguments and decrypt results.
method __init__
__init__(
client_specs: ClientSpecs,
keyset_cache_directory: Optional[Path, str] = None,
is_simulated: bool = False
)
property evaluation_keys
Get evaluation keys for encrypted computation.
Returns: EvaluationKeys evaluation keys for encrypted computation
property keys
Get the keys for the client.
property specs
Get the client specs for the client.
method decrypt
decrypt(
*results: Union[Value, tuple[Value, ]],
function_name: Optional[str] = None
) → Union[int, ndarray, tuple[Union[int, ndarray, NoneType], ], NoneType]
Decrypt result(s) of evaluation.
Args: *results (Union[Value, Tuple[Value, ...]]): result(s) of evaluation function_name (str): name of the function to decrypt for
Returns: Optional[Union[int, np.ndarray, Tuple[Optional[Union[int, np.ndarray]], ...]]]: decrypted result(s) of evaluation
method encrypt
encrypt(
*args: Optional[int, ndarray, list],
function_name: Optional[str] = None
) → Union[Value, tuple[Optional[Value], ], NoneType]
Encrypt argument(s) to for evaluation.
Args: *args (Optional[Union[int, np.ndarray, List]]): argument(s) for evaluation function_name (str): name of the function to encrypt
Returns: Optional[Union[Value, Tuple[Optional[Value], ...]]]: encrypted argument(s) for evaluation
method keygen
keygen(
force: bool = False,
secret_seed: Optional[int] = None,
encryption_seed: Optional[int] = None,
initial_keys: Optional[dict[int, LweSecretKey]] = None
)
Generate keys required for homomorphic evaluation.
Args: force (bool, default = False): whether to generate new keys even if keys are already generated
secret_seed (Optional[int], default = None): seed for private keys randomness
encryption_seed (Optional[int], default = None): seed for encryption randomness
initial_keys (Optional[Dict[int, LweSecretKey]] = None): initial keys to set before keygen
method load
load(
path: Union[str, Path],
keyset_cache_directory: Optional[Path, str] = None,
is_simulated: bool = False
) → Client
Load the client from the given path in zip format.
Args: path (Union[str, Path]): path to load the client from
keyset_cache_directory (Optional[Union[str, Path]], default = None): keyset cache directory to use
is_simulated (bool, default = False): should perform
Returns: Client: client loaded from the filesystem
method save
save(path: Union[str, Path])
Save the client into the given path in zip format.
Args: path (Union[str, Path]): path to save the client
method simulate_decrypt
simulate_decrypt(
*results: Union[Value, tuple[Value, ]],
function_name: Optional[str] = None
) → Union[int, ndarray, tuple[Union[int, ndarray, NoneType], ], NoneType]
Simulate decryption of result(s) of evaluation.
Args: *results (Union[Value, Tuple[Value, ...]]): result(s) of evaluation function_name (str): name of the function to decrypt for
Returns: Optional[Union[int, np.ndarray, Tuple[Optional[Union[int, np.ndarray]], ...]]]: decrypted result(s) of evaluation
method simulate_encrypt
simulate_encrypt(
*args: Optional[int, ndarray, list],
function_name: Optional[str] = None
) → Union[Value, tuple[Optional[Value], ], NoneType]
Simulate encryption of argument(s) for evaluation.
Args: *args (Optional[Union[int, np.ndarray, List]]): argument(s) for evaluation function_name (str): name of the function to encrypt
Returns: Optional[Union[Value, Tuple[Optional[Value], ...]]]: encrypted argument(s) for evaluation