diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md
index 69ad161b8..4c977be4b 100644
--- a/docs/SUMMARY.md
+++ b/docs/SUMMARY.md
@@ -55,6 +55,7 @@
- [concrete.ml.common.debugging.custom_assert.md](developer-guide/api/concrete.ml.common.debugging.custom_assert.md)
- [concrete.ml.common.debugging.md](developer-guide/api/concrete.ml.common.debugging.md)
- [concrete.ml.common.md](developer-guide/api/concrete.ml.common.md)
+ - [concrete.ml.common.serialization.decoder.md](developer-guide/api/concrete.ml.common.serialization.decoder.md)
- [concrete.ml.common.serialization.dumpers.md](developer-guide/api/concrete.ml.common.serialization.dumpers.md)
- [concrete.ml.common.serialization.encoder.md](developer-guide/api/concrete.ml.common.serialization.encoder.md)
- [concrete.ml.common.serialization.loaders.md](developer-guide/api/concrete.ml.common.serialization.loaders.md)
diff --git a/docs/developer-guide/api/README.md b/docs/developer-guide/api/README.md
index 536179afe..61fe19f25 100644
--- a/docs/developer-guide/api/README.md
+++ b/docs/developer-guide/api/README.md
@@ -8,7 +8,8 @@
- [`concrete.ml.common.check_inputs`](./concrete.ml.common.check_inputs.md#module-concretemlcommoncheck_inputs): Check and conversion tools.
- [`concrete.ml.common.debugging`](./concrete.ml.common.debugging.md#module-concretemlcommondebugging): Module for debugging.
- [`concrete.ml.common.debugging.custom_assert`](./concrete.ml.common.debugging.custom_assert.md#module-concretemlcommondebuggingcustom_assert): Provide some variants of assert.
-- [`concrete.ml.common.serialization`](./concrete.ml.common.serialization.md#module-concretemlcommonserialization)
+- [`concrete.ml.common.serialization`](./concrete.ml.common.serialization.md#module-concretemlcommonserialization): Serialization module.
+- [`concrete.ml.common.serialization.decoder`](./concrete.ml.common.serialization.decoder.md#module-concretemlcommonserializationdecoder): Custom decoder for serialization.
- [`concrete.ml.common.serialization.dumpers`](./concrete.ml.common.serialization.dumpers.md#module-concretemlcommonserializationdumpers): Dump functions for serialization.
- [`concrete.ml.common.serialization.encoder`](./concrete.ml.common.serialization.encoder.md#module-concretemlcommonserializationencoder): Custom encoder for serialization.
- [`concrete.ml.common.serialization.loaders`](./concrete.ml.common.serialization.loaders.md#module-concretemlcommonserializationloaders): Load functions for serialization.
@@ -54,7 +55,8 @@
## Classes
-- [`encoder.CustomEncoder`](./concrete.ml.common.serialization.encoder.md#class-customencoder): CustomEncoder: custom json encoder to handle non-native types.
+- [`decoder.ConcreteDecoder`](./concrete.ml.common.serialization.decoder.md#class-concretedecoder): Custom json decoder to handle non-native types found in serialized Concrete ML objects.
+- [`encoder.ConcreteEncoder`](./concrete.ml.common.serialization.encoder.md#class-concreteencoder): Custom json encoder to handle non-native types found in serialized Concrete ML objects.
- [`utils.FheMode`](./concrete.ml.common.utils.md#class-fhemode): Enum representing the execution mode.
- [`deploy_to_aws.AWSInstance`](./concrete.ml.deployment.deploy_to_aws.md#class-awsinstance): AWSInstance.
- [`fhe_client_server.FHEModelClient`](./concrete.ml.deployment.fhe_client_server.md#class-fhemodelclient): Client API to encrypt and decrypt FHE data.
@@ -69,6 +71,7 @@
- [`torch_models.CNNInvalid`](./concrete.ml.pytest.torch_models.md#class-cnninvalid): Torch CNN model for the tests.
- [`torch_models.CNNMaxPool`](./concrete.ml.pytest.torch_models.md#class-cnnmaxpool): Torch CNN model for the tests with a max pool.
- [`torch_models.CNNOther`](./concrete.ml.pytest.torch_models.md#class-cnnother): Torch CNN model for the tests.
+- [`torch_models.ConcatFancyIndexing`](./concrete.ml.pytest.torch_models.md#class-concatfancyindexing): Concat with fancy indexing.
- [`torch_models.DoubleQuantQATMixNet`](./concrete.ml.pytest.torch_models.md#class-doublequantqatmixnet): Torch model that with two different quantizers on the input.
- [`torch_models.FC`](./concrete.ml.pytest.torch_models.md#class-fc): Torch model for the tests.
- [`torch_models.FCSeq`](./concrete.ml.pytest.torch_models.md#class-fcseq): Torch model that should generate MatMul->Add ONNX patterns.
@@ -76,6 +79,7 @@
- [`torch_models.FCSmall`](./concrete.ml.pytest.torch_models.md#class-fcsmall): Torch model for the tests.
- [`torch_models.MultiInputNN`](./concrete.ml.pytest.torch_models.md#class-multiinputnn): Torch model to test multiple inputs forward.
- [`torch_models.MultiInputNNConfigurable`](./concrete.ml.pytest.torch_models.md#class-multiinputnnconfigurable): Torch model to test multiple inputs forward.
+- [`torch_models.MultiInputNNDifferentSize`](./concrete.ml.pytest.torch_models.md#class-multiinputnndifferentsize): Torch model to test multiple inputs with different shape in the forward pass.
- [`torch_models.MultiOpOnSingleInputConvNN`](./concrete.ml.pytest.torch_models.md#class-multioponsingleinputconvnn): Network that applies two quantized operations on a single input.
- [`torch_models.NetWithConcatUnsqueeze`](./concrete.ml.pytest.torch_models.md#class-netwithconcatunsqueeze): Torch model to test the concat and unsqueeze operators.
- [`torch_models.NetWithConstantsFoldedBeforeOps`](./concrete.ml.pytest.torch_models.md#class-netwithconstantsfoldedbeforeops): Torch QAT model that does not quantize the inputs.
@@ -87,7 +91,7 @@
- [`torch_models.ShapeOperationsNet`](./concrete.ml.pytest.torch_models.md#class-shapeoperationsnet): Torch QAT model that reshapes the input.
- [`torch_models.SimpleNet`](./concrete.ml.pytest.torch_models.md#class-simplenet): Fake torch model used to generate some onnx.
- [`torch_models.SimpleQAT`](./concrete.ml.pytest.torch_models.md#class-simpleqat): Torch model implements a step function that needs Greater, Cast and Where.
-- [`torch_models.SingleMixNet`](./concrete.ml.pytest.torch_models.md#class-singlemixnet): Torch model that with a single conv layer that produces the output, eg a blur filter.
+- [`torch_models.SingleMixNet`](./concrete.ml.pytest.torch_models.md#class-singlemixnet): Torch model that with a single conv layer that produces the output, e.g., a blur filter.
- [`torch_models.StepActivationModule`](./concrete.ml.pytest.torch_models.md#class-stepactivationmodule): Torch model implements a step function that needs Greater, Cast and Where.
- [`torch_models.TinyCNN`](./concrete.ml.pytest.torch_models.md#class-tinycnn): A very small CNN.
- [`torch_models.TinyQATCNN`](./concrete.ml.pytest.torch_models.md#class-tinyqatcnn): A very small QAT CNN to classify the sklearn digits data-set.
@@ -201,17 +205,15 @@
- [`custom_assert.assert_false`](./concrete.ml.common.debugging.custom_assert.md#function-assert_false): Provide a custom assert to check that the condition is False.
- [`custom_assert.assert_not_reached`](./concrete.ml.common.debugging.custom_assert.md#function-assert_not_reached): Provide a custom assert to check that a piece of code is never reached.
- [`custom_assert.assert_true`](./concrete.ml.common.debugging.custom_assert.md#function-assert_true): Provide a custom assert to check that the condition is True.
-- [`dumpers.dump`](./concrete.ml.common.serialization.dumpers.md#function-dump): Dump any Concrete ML object that has a dump method.
-- [`dumpers.dumps`](./concrete.ml.common.serialization.dumpers.md#function-dumps): Dump as string any object.
-- [`dumpers.dumps_random_state`](./concrete.ml.common.serialization.dumpers.md#function-dumps_random_state): Dump random state to string.
-- [`encoder.dumps_onnx`](./concrete.ml.common.serialization.encoder.md#function-dumps_onnx): Dump onnx model as string.
-- [`loaders.load`](./concrete.ml.common.serialization.loaders.md#function-load): Load any Concrete ML object that has a dump method.
-- [`loaders.load_dict`](./concrete.ml.common.serialization.loaders.md#function-load_dict): Load any Concrete ML object that has a dump method.
-- [`loaders.loads`](./concrete.ml.common.serialization.loaders.md#function-loads): Load any Concrete ML object that has a dump method.
-- [`loaders.loads_onnx`](./concrete.ml.common.serialization.loaders.md#function-loads_onnx): Load serialized onnx model.
-- [`loaders.loads_random_state`](./concrete.ml.common.serialization.loaders.md#function-loads_random_state): Load random state from string.
-- [`utils.all_values_are_floats`](./concrete.ml.common.utils.md#function-all_values_are_floats): Indicate that all unpacked values are of a supported float dtype.
-- [`utils.all_values_are_integers`](./concrete.ml.common.utils.md#function-all_values_are_integers): Indicate that all unpacked values are of a supported integer dtype.
+- [`decoder.object_hook`](./concrete.ml.common.serialization.decoder.md#function-object_hook): Define a custom object hook that enables loading any supported serialized values.
+- [`dumpers.dump`](./concrete.ml.common.serialization.dumpers.md#function-dump): Dump any Concrete ML object in a file.
+- [`dumpers.dumps`](./concrete.ml.common.serialization.dumpers.md#function-dumps): Dump any object as a string.
+- [`encoder.dump_name_and_value`](./concrete.ml.common.serialization.encoder.md#function-dump_name_and_value): Dump the value into a custom dict format.
+- [`loaders.load`](./concrete.ml.common.serialization.loaders.md#function-load): Load any Concrete ML object that provide a `load_dict` method.
+- [`loaders.loads`](./concrete.ml.common.serialization.loaders.md#function-loads): Load any Concrete ML object that provide a `dump_dict` method.
+- [`utils.all_values_are_floats`](./concrete.ml.common.utils.md#function-all_values_are_floats): Indicate if all unpacked values are of a supported float dtype.
+- [`utils.all_values_are_integers`](./concrete.ml.common.utils.md#function-all_values_are_integers): Indicate if all unpacked values are of a supported integer dtype.
+- [`utils.all_values_are_of_dtype`](./concrete.ml.common.utils.md#function-all_values_are_of_dtype): Indicate if all unpacked values are of the specified dtype(s).
- [`utils.check_dtype_and_cast`](./concrete.ml.common.utils.md#function-check_dtype_and_cast): Convert any allowed type into an array and cast it if required.
- [`utils.check_there_is_no_p_error_options_in_configuration`](./concrete.ml.common.utils.md#function-check_there_is_no_p_error_options_in_configuration): Check the user did not set p_error or global_p_error in configuration.
- [`utils.compute_bits_precision`](./concrete.ml.common.utils.md#function-compute_bits_precision): Compute the number of bits required to represent x.
@@ -324,11 +326,13 @@
- [`ops_impl.numpy_where`](./concrete.ml.onnx.ops_impl.md#function-numpy_where): Compute the equivalent of numpy.where.
- [`ops_impl.numpy_where_body`](./concrete.ml.onnx.ops_impl.md#function-numpy_where_body): Compute the equivalent of numpy.where.
- [`ops_impl.onnx_func_raw_args`](./concrete.ml.onnx.ops_impl.md#function-onnx_func_raw_args): Decorate a numpy onnx function to flag the raw/non quantized inputs.
+- [`utils.check_serialization`](./concrete.ml.pytest.utils.md#function-check_serialization): Check that the given object can properly be serialized.
- [`utils.data_calibration_processing`](./concrete.ml.pytest.utils.md#function-data_calibration_processing): Reduce size of the given data-set.
- [`utils.get_random_extract_of_sklearn_models_and_datasets`](./concrete.ml.pytest.utils.md#function-get_random_extract_of_sklearn_models_and_datasets): Return a random sublist of sklearn_models_and_datasets.
- [`utils.get_torchvision_dataset`](./concrete.ml.pytest.utils.md#function-get_torchvision_dataset): Get train or testing data-set.
- [`utils.instantiate_model_generic`](./concrete.ml.pytest.utils.md#function-instantiate_model_generic): Instantiate any Concrete ML model type.
- [`utils.load_torch_model`](./concrete.ml.pytest.utils.md#function-load_torch_model): Load an object saved with torch.save() from a file or dict.
+- [`utils.values_are_equal`](./concrete.ml.pytest.utils.md#function-values_are_equal): Indicate if two values are equal.
- [`post_training.get_n_bits_dict`](./concrete.ml.quantization.post_training.md#function-get_n_bits_dict): Convert the n_bits parameter into a proper dictionary.
- [`quantizers.fill_from_kwargs`](./concrete.ml.quantization.quantizers.md#function-fill_from_kwargs): Fill a parameter set structure from kwargs parameters.
- [`p_error_search.compile_and_simulated_fhe_inference`](./concrete.ml.search_parameters.p_error_search.md#function-compile_and_simulated_fhe_inference): Get the quantized module of a given model in FHE, simulated or not.
@@ -343,6 +347,7 @@
- [`tree_to_numpy.tree_to_numpy`](./concrete.ml.sklearn.tree_to_numpy.md#function-tree_to_numpy): Convert the tree inference to a numpy functions using Hummingbird.
- [`tree_to_numpy.tree_values_preprocessing`](./concrete.ml.sklearn.tree_to_numpy.md#function-tree_values_preprocessing): Pre-process tree values.
- [`tree_to_numpy.workaround_squeeze_node_xgboost`](./concrete.ml.sklearn.tree_to_numpy.md#function-workaround_squeeze_node_xgboost): Workaround to fix torch issue that does not export the proper axis in the ONNX squeeze node.
+- [`compile.build_quantized_module`](./concrete.ml.torch.compile.md#function-build_quantized_module): Build a quantized module from a Torch or ONNX model.
- [`compile.compile_brevitas_qat_model`](./concrete.ml.torch.compile.md#function-compile_brevitas_qat_model): Compile a Brevitas Quantization Aware Training model.
- [`compile.compile_onnx_model`](./concrete.ml.torch.compile.md#function-compile_onnx_model): Compile a torch module into an FHE equivalent.
- [`compile.compile_torch_model`](./concrete.ml.torch.compile.md#function-compile_torch_model): Compile a torch module into an FHE equivalent.
diff --git a/docs/developer-guide/api/concrete.ml.common.serialization.decoder.md b/docs/developer-guide/api/concrete.ml.common.serialization.decoder.md
new file mode 100644
index 000000000..f381a65ed
--- /dev/null
+++ b/docs/developer-guide/api/concrete.ml.common.serialization.decoder.md
@@ -0,0 +1,57 @@
+
+
+
+
+# module `concrete.ml.common.serialization.decoder`
+
+Custom decoder for serialization.
+
+## **Global Variables**
+
+- **ALL_QUANTIZED_OPS**
+- **SUPPORTED_TORCH_ACTIVATIONS**
+- **USE_SKOPS**
+- **TRUSTED_SKOPS**
+- **SERIALIZABLE_CLASSES**
+
+______________________________________________________________________
+
+
+
+## function `object_hook`
+
+```python
+object_hook(d: Any) → Any
+```
+
+Define a custom object hook that enables loading any supported serialized values.
+
+If the input's type is non-native, then we expect it to have the following format.More information is available in the ConcreteEncoder class.
+
+**Args:**
+
+- `d` (Any): The serialized value to load.
+
+**Returns:**
+
+- `Any`: The loaded value.
+
+**Raises:**
+
+- `NotImplementedError`: If the serialized object does not provides a `dump_dict` method as expected.
+
+______________________________________________________________________
+
+
+
+## class `ConcreteDecoder`
+
+Custom json decoder to handle non-native types found in serialized Concrete ML objects.
+
+
+
+### method `__init__`
+
+```python
+__init__(*args, **kwargs)
+```
diff --git a/docs/developer-guide/api/concrete.ml.common.serialization.dumpers.md b/docs/developer-guide/api/concrete.ml.common.serialization.dumpers.md
index c2fd5f558..466cfd244 100644
--- a/docs/developer-guide/api/concrete.ml.common.serialization.dumpers.md
+++ b/docs/developer-guide/api/concrete.ml.common.serialization.dumpers.md
@@ -8,27 +8,27 @@ Dump functions for serialization.
______________________________________________________________________
-
+
-## function `dumps_random_state`
+## function `dumps`
```python
-dumps_random_state(random_state: Optional[RandomState, int]) → str
+dumps(obj: Any) → str
```
-Dump random state to string.
+Dump any object as a string.
**Arguments:**
-- `random_state` (Union\[RandomState, int, None\]): a random state
+- `obj` (Any): Object to dump.
**Returns:**
-- `str`: a serialized version of the random state
+- `str`: A string representation of the object.
______________________________________________________________________
-
+
## function `dump`
@@ -36,31 +36,9 @@ ______________________________________________________________________
dump(obj: Any, file: )
```
-Dump any Concrete ML object that has a dump method.
+Dump any Concrete ML object in a file.
**Arguments:**
-- `obj` (Any): the object to dump.
-- `file` (TextIO): a file containing the serialized object.
-
-______________________________________________________________________
-
-
-
-## function `dumps`
-
-```python
-dumps(obj: Any) → str
-```
-
-Dump as string any object.
-
-If the object has some `dumps` method then it uses that. Otherwise the object is casted as `str`.
-
-**Arguments:**
-
-- `obj` (Any): any object.
-
-**Returns:**
-
-- `str`: a string representation of the object.
+- `obj` (Any): The object to dump.
+- `file` (TextIO): The file to dump the serialized object into.
diff --git a/docs/developer-guide/api/concrete.ml.common.serialization.encoder.md b/docs/developer-guide/api/concrete.ml.common.serialization.encoder.md
index d89ff7a7e..8a52cb17e 100644
--- a/docs/developer-guide/api/concrete.ml.common.serialization.encoder.md
+++ b/docs/developer-guide/api/concrete.ml.common.serialization.encoder.md
@@ -6,37 +6,50 @@
Custom encoder for serialization.
+## **Global Variables**
+
+- **INFINITY**
+- **USE_SKOPS**
+
______________________________________________________________________
-
+
-## function `dumps_onnx`
+## function `dump_name_and_value`
```python
-dumps_onnx(onnx_model: ModelProto) → str
+dump_name_and_value(name: str, value: Any, **kwargs) → Dict
```
-Dump onnx model as string.
+Dump the value into a custom dict format.
-**Arguments:**
+**Args:**
-- `onnx_model` (onnx.ModelProto): an onnx model.
+- `name` (str): The custom name to use. This name should be unique for each type to encode, as it is used in the ConcreteDecoder class to detect the initial type and apply the proper load method to the serialized object.
+- `value` (Any): The serialized value to dump.
+- `**kwargs (dict)`: Additional arguments to dump.
**Returns:**
-- `str`: a serialized version of the onnx model.
+- `Dict`: The serialized custom format that includes both the serialized value and its type name.
______________________________________________________________________
-
+
+
+## class `ConcreteEncoder`
+
+Custom json encoder to handle non-native types found in serialized Concrete ML objects.
-## class `CustomEncoder`
+Non-native types are serialized manually and dumped in a custom dict format that stores both the serialization value of the object and its associated type name.
-CustomEncoder: custom json encoder to handle non-native types.
+The name should be unique for each type, as it is used in the ConcreteDecoder class to detect the initial type and apply the proper load method to the serialized object. The serialized value is the value that was serialized manually in a native type. Additional arguments such as a numpy array's dtype are also properly serialized. If an object has an unexpected type or is not serializable, an error is thrown.
+
+The ConcreteEncoder is only meant to encode Concrete-ML's built-in models and therefore only supports the necessary types. For example, torch.Tensor objects are not serializable using this encoder as built-in models only use numpy arrays. However, the list of supported types might expand in future releases if new models are added and need new types.
______________________________________________________________________
-
+
### method `default`
@@ -44,15 +57,62 @@ ______________________________________________________________________
default(o: Any) → Any
```
-Overload default serialization.
+Define a custom default method that enables dumping any supported serialized values.
**Arguments:**
-- `o` (Any): the object to serialize.
+- `o` (Any): The object to serialize.
**Returns:**
-The serialized object.
+
+- `Any`: The serialized object. Non-native types are returned as a dict of a specific format.
**Raises:**
-- `NotImplementedError`: if an FHE.Circuit is given.
+- `NotImplementedError`: If an FHE.Circuit, a Callable or a Generator object is given.
+
+______________________________________________________________________
+
+
+
+### method `isinstance`
+
+```python
+isinstance(o: Any, cls: Type) → bool
+```
+
+Define a custom isinstance method.
+
+Natively, among other types, the JSONENcoder handles integers, floating points and tuples. However, a numpy.integer (resp. numpy.floating) object is automatically casted to a built-in int (resp. float) object, without keeping their dtype information. Similarly, a tuple is casted to a list, meaning that it will then be loaded as a list, which notably does not have the uniqueness property and therefore might cause issues in complex structures such as QuantizedModule instances. This is an issue as JSONEncoder only calls its customizable `default` method at the end of the parsing. We thus need to provide this custom isinstance method in order to make the encoder avoid handling these specific types until `default` is reached (where they are properly serialized using our custom format).
+
+**Args:**
+
+- `o` (Any): The object to serialize.
+- `cls` (Type): The type to compare the object with.
+
+**Returns:**
+
+- `bool`: If the object is of the given type. False if it is a numpy.floating, numpy.integer or a tuple.
+
+______________________________________________________________________
+
+
+
+### method `iterencode`
+
+```python
+iterencode(o: Any, _one_shot: bool = False) → Generator
+```
+
+Encode the given object and yield each string representation as available.
+
+This method overrides the JSONEncoder's native iterencode one in order to pass our custom isinstance method to the `_make_iterencode` function. More information in `isinstance`'s docstring. For simplicity, iterencode does not give the ability to use the initial `c_make_encoder` function, as it would required to override it in C.
+
+**Args:**
+
+- `o` (Any): The object to serialize.
+- `_one_shot` (bool): This parameter is not used since the `_make_iterencode` function has been removed from the method.
+
+**Returns:**
+
+- `Generator`: Yield each string representation as available.
diff --git a/docs/developer-guide/api/concrete.ml.common.serialization.loaders.md b/docs/developer-guide/api/concrete.ml.common.serialization.loaders.md
index aeac17f3b..58c1589af 100644
--- a/docs/developer-guide/api/concrete.ml.common.serialization.loaders.md
+++ b/docs/developer-guide/api/concrete.ml.common.serialization.loaders.md
@@ -6,112 +6,42 @@
Load functions for serialization.
-## **Global Variables**
-
-- **LOADS_METHODS**
-
______________________________________________________________________
-
-
-## function `load_dict`
-
-```python
-load_dict(metadata: Dict[str, Any]) → Any
-```
-
-Load any Concrete ML object that has a dump method.
-
-**Arguments:**
-
-- `metadata` (Dict\[str, Any\]): a dict of a serialized object.
-
-**Returns:**
-
-- `Any`: the object itself.
-
-**Raises:**
-
-- `ValueError`: if "cml_dumped_class_name" key is not in the serialized object.
-
-______________________________________________________________________
-
-
+
## function `loads`
```python
-loads(content: str) → Any
+loads(content: Union[str, bytes]) → Any
```
-Load any Concrete ML object that has a dump method.
+Load any Concrete ML object that provide a `dump_dict` method.
**Arguments:**
-- `content` (str): a serialized object.
+- `content` (Union\[str, bytes\]): A serialized object.
**Returns:**
-- `Any`: the object itself.
+- `Any`: The object itself.
______________________________________________________________________
-
+
## function `load`
```python
-load(file: )
-```
-
-Load any Concrete ML object that has a dump method.
-
-**Arguments:**
-
-- `file` (TextIO): a file containing the serialized object.
-
-**Returns:**
-
-- `Any`: the object itself.
-
-______________________________________________________________________
-
-
-
-## function `loads_onnx`
-
-```python
-loads_onnx(serialized_onnx: str) → ModelProto
-```
-
-Load serialized onnx model.
-
-**Arguments:**
-
-- `serialized_onnx` (str): a serialized onnx model.
-
-**Returns:**
-
-- `onnx.ModelProto`: the onnx model
-
-______________________________________________________________________
-
-
-
-## function `loads_random_state`
-
-```python
-loads_random_state(
- serialized_random_state: str
-) → Union[RandomState, int, NoneType]
+load(file: Union[IO[str], IO[bytes]])
```
-Load random state from string.
+Load any Concrete ML object that provide a `load_dict` method.
**Arguments:**
-- `serialized_random_state` (str): a serialized version of the random state
+- `file` (Union\[IO\[str\], IO\[bytes\]): The file containing the serialized object.
**Returns:**
-- `random_state` (Union\[RandomState, int, None\]): a random state
+- `Any`: The object itself.
diff --git a/docs/developer-guide/api/concrete.ml.common.serialization.md b/docs/developer-guide/api/concrete.ml.common.serialization.md
index 8fab6f876..95eb4c836 100644
--- a/docs/developer-guide/api/concrete.ml.common.serialization.md
+++ b/docs/developer-guide/api/concrete.ml.common.serialization.md
@@ -1,5 +1,13 @@
-
+
# module `concrete.ml.common.serialization`
+
+Serialization module.
+
+## **Global Variables**
+
+- **USE_SKOPS**
+- **SUPPORTED_TORCH_ACTIVATIONS**
+- **UNSUPPORTED_TORCH_ACTIVATIONS**
diff --git a/docs/developer-guide/api/concrete.ml.common.utils.md b/docs/developer-guide/api/concrete.ml.common.utils.md
index c2b933f6a..2202ed11c 100644
--- a/docs/developer-guide/api/concrete.ml.common.utils.md
+++ b/docs/developer-guide/api/concrete.ml.common.utils.md
@@ -10,11 +10,12 @@ Utils that can be re-used by other pieces of code in the module.
- **SUPPORTED_FLOAT_TYPES**
- **SUPPORTED_INT_TYPES**
+- **SUPPORTED_TYPES**
- **MAX_BITWIDTH_BACKWARD_COMPATIBLE**
______________________________________________________________________
-
+
## function `replace_invalid_arg_name_chars`
@@ -36,7 +37,7 @@ This does not check that the starting character of arg_name is valid.
______________________________________________________________________
-
+
## function `generate_proxy_function`
@@ -62,7 +63,7 @@ This returns a runtime compiled function with the sanitized argument names passe
______________________________________________________________________
-
+
## function `get_onnx_opset_version`
@@ -82,7 +83,7 @@ Return the ONNX opset_version.
______________________________________________________________________
-
+
## function `manage_parameters_for_pbs_errors`
@@ -119,7 +120,7 @@ Note that global_p_error is currently set to 0 in the FHE simulation mode.
______________________________________________________________________
-
+
## function `check_there_is_no_p_error_options_in_configuration`
@@ -137,7 +138,7 @@ It would be dangerous, since we set them in direct arguments in our calls to Con
______________________________________________________________________
-
+
## function `get_model_class`
@@ -156,7 +157,7 @@ The model's class.
______________________________________________________________________
-
+
## function `is_model_class_in_a_list`
@@ -176,7 +177,7 @@ If the model's class is in the list or not.
______________________________________________________________________
-
+
## function `get_model_name`
@@ -195,7 +196,7 @@ the model's name.
______________________________________________________________________
-
+
## function `is_classifier_or_partial_classifier`
@@ -215,7 +216,7 @@ Indicate if the model class represents a classifier.
______________________________________________________________________
-
+
## function `is_regressor_or_partial_regressor`
@@ -235,7 +236,7 @@ Indicate if the model class represents a regressor.
______________________________________________________________________
-
+
## function `is_pandas_dataframe`
@@ -257,7 +258,7 @@ This function is inspired from Scikit-Learn's test validation tools and avoids t
______________________________________________________________________
-
+
## function `is_pandas_series`
@@ -279,7 +280,7 @@ This function is inspired from Scikit-Learn's test validation tools and avoids t
______________________________________________________________________
-
+
## function `is_pandas_type`
@@ -299,7 +300,7 @@ Indicate if the input container is a Pandas DataFrame or Series.
______________________________________________________________________
-
+
## function `check_dtype_and_cast`
@@ -331,7 +332,7 @@ If values types don't match with any supported type or the expected dtype, raise
______________________________________________________________________
-
+
## function `compute_bits_precision`
@@ -351,7 +352,7 @@ Compute the number of bits required to represent x.
______________________________________________________________________
-
+
## function `is_brevitas_model`
@@ -371,7 +372,7 @@ Check if a model is a Brevitas type.
______________________________________________________________________
-
+
## function `to_tuple`
@@ -391,7 +392,7 @@ Make the input a tuple if it is not already the case.
______________________________________________________________________
-
+
## function `all_values_are_integers`
@@ -399,7 +400,7 @@ ______________________________________________________________________
all_values_are_integers(*values: Any) → bool
```
-Indicate that all unpacked values are of a supported integer dtype.
+Indicate if all unpacked values are of a supported integer dtype.
**Args:**
@@ -411,7 +412,7 @@ Indicate that all unpacked values are of a supported integer dtype.
______________________________________________________________________
-
+
## function `all_values_are_floats`
@@ -419,7 +420,7 @@ ______________________________________________________________________
all_values_are_floats(*values: Any) → bool
```
-Indicate that all unpacked values are of a supported float dtype.
+Indicate if all unpacked values are of a supported float dtype.
**Args:**
@@ -431,7 +432,28 @@ Indicate that all unpacked values are of a supported float dtype.
______________________________________________________________________
-
+
+
+## function `all_values_are_of_dtype`
+
+```python
+all_values_are_of_dtype(*values: Any, dtypes: Union[str, List[str]]) → bool
+```
+
+Indicate if all unpacked values are of the specified dtype(s).
+
+**Args:**
+
+- `*values (Any)`: The values to consider.
+- `dtypes` (Union\[str, List\[str\]\]): The dtype(s) to consider.
+
+**Returns:**
+
+- `bool`: Whether all values are of the specified dtype(s) or not.
+
+______________________________________________________________________
+
+
## class `FheMode`
diff --git a/docs/developer-guide/api/concrete.ml.deployment.deploy_to_aws.md b/docs/developer-guide/api/concrete.ml.deployment.deploy_to_aws.md
index eafb1813b..f6a8fa828 100644
--- a/docs/developer-guide/api/concrete.ml.deployment.deploy_to_aws.md
+++ b/docs/developer-guide/api/concrete.ml.deployment.deploy_to_aws.md
@@ -20,7 +20,7 @@ It spawns a AWS EC2 instance with proper security groups. Then SSHs to it to rsy
______________________________________________________________________
-
+
## function `create_instance`
@@ -58,7 +58,7 @@ Create a EC2 instance.
______________________________________________________________________
-
+
## function `deploy_to_aws`
@@ -91,7 +91,7 @@ instance_metadata (Dict\[str, Any\])
______________________________________________________________________
-
+
## function `wait_instance_termination`
@@ -108,7 +108,7 @@ Wait for AWS EC2 instance termination.
______________________________________________________________________
-
+
## function `terminate_instance`
@@ -125,7 +125,7 @@ Terminate a AWS EC2 instance.
______________________________________________________________________
-
+
## function `delete_security_group`
@@ -142,7 +142,7 @@ Terminate a AWS EC2 instance.
______________________________________________________________________
-
+
## function `main`
@@ -172,7 +172,7 @@ Deploy a model.
______________________________________________________________________
-
+
## class `AWSInstance`
@@ -180,7 +180,7 @@ AWSInstance.
Context manager for AWS instance that supports ssh and http over one port.
-
+
### method `__init__`
diff --git a/docs/developer-guide/api/concrete.ml.deployment.fhe_client_server.md b/docs/developer-guide/api/concrete.ml.deployment.fhe_client_server.md
index aba7a7d86..13daff327 100644
--- a/docs/developer-guide/api/concrete.ml.deployment.fhe_client_server.md
+++ b/docs/developer-guide/api/concrete.ml.deployment.fhe_client_server.md
@@ -9,17 +9,16 @@ APIs for FHE deployment.
## **Global Variables**
- **CML_VERSION**
-- **AVAILABLE_MODEL**
______________________________________________________________________
-
+
## class `FHEModelServer`
Server API to load and run the FHE circuit.
-
+
### method `__init__`
@@ -35,7 +34,7 @@ Initialize the FHE API.
______________________________________________________________________
-
+
### method `load`
@@ -51,7 +50,7 @@ Load the circuit.
______________________________________________________________________
-
+
### method `run`
@@ -75,13 +74,13 @@ Run the model on the server over encrypted data.
______________________________________________________________________
-
+
## class `FHEModelDev`
Dev API to save the model and then load and run the FHE circuit.
-
+
### method `__init__`
@@ -98,7 +97,7 @@ Initialize the FHE API.
______________________________________________________________________
-
+
### method `save`
@@ -118,13 +117,13 @@ Export all needed artifacts for the client and server.
______________________________________________________________________
-
+
## class `FHEModelClient`
Client API to encrypt and decrypt FHE data.
-
+
### method `__init__`
@@ -141,7 +140,7 @@ Initialize the FHE API.
______________________________________________________________________
-
+
### method `deserialize_decrypt`
@@ -161,7 +160,7 @@ Deserialize and decrypt the values.
______________________________________________________________________
-
+
### method `deserialize_decrypt_dequantize`
@@ -183,7 +182,7 @@ Deserialize, decrypt and de-quantize the values.
______________________________________________________________________
-
+
### method `generate_private_and_evaluation_keys`
@@ -199,7 +198,7 @@ Generate the private and evaluation keys.
______________________________________________________________________
-
+
### method `get_serialized_evaluation_keys`
@@ -215,7 +214,7 @@ Get the serialized evaluation keys.
______________________________________________________________________
-
+
### method `load`
@@ -231,7 +230,7 @@ Load the quantizers along with the FHE specs.
______________________________________________________________________
-
+
### method `quantize_encrypt_serialize`
diff --git a/docs/developer-guide/api/concrete.ml.onnx.ops_impl.md b/docs/developer-guide/api/concrete.ml.onnx.ops_impl.md
index 00af686e2..f0079e5f8 100644
--- a/docs/developer-guide/api/concrete.ml.onnx.ops_impl.md
+++ b/docs/developer-guide/api/concrete.ml.onnx.ops_impl.md
@@ -59,7 +59,7 @@ numpy_where_body(c: ndarray, t: ndarray, f: Union[ndarray, int]) → ndarray
Compute the equivalent of numpy.where.
-This function is not mapped to any ONNX operator (as opposed to numpy_where). It is usable by functions which are mapped to ONNX operators, eg numpy_div or numpy_where.
+This function is not mapped to any ONNX operator (as opposed to numpy_where). It is usable by functions which are mapped to ONNX operators, e.g., numpy_div or numpy_where.
**Args:**
diff --git a/docs/developer-guide/api/concrete.ml.pytest.torch_models.md b/docs/developer-guide/api/concrete.ml.pytest.torch_models.md
index 178b945f0..e977cb5bf 100644
--- a/docs/developer-guide/api/concrete.ml.pytest.torch_models.md
+++ b/docs/developer-guide/api/concrete.ml.pytest.torch_models.md
@@ -400,11 +400,52 @@ ______________________________________________________________________
+## class `MultiInputNNDifferentSize`
+
+Torch model to test multiple inputs with different shape in the forward pass.
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ input_output,
+ activation_function=None,
+ is_brevitas_qat=False,
+ n_bits=3
+)
+```
+
+______________________________________________________________________
+
+
+
+### method `forward`
+
+```python
+forward(x, y)
+```
+
+Forward pass.
+
+**Args:**
+
+- `x`: The first input of the NN.
+- `y`: The second input of the NN.
+
+**Returns:**
+The output of the NN.
+
+______________________________________________________________________
+
+
+
## class `BranchingModule`
Torch model with some branching and skip connections.
-
+
### method `__init__`
@@ -414,7 +455,7 @@ __init__(input_output, activation_function)
______________________________________________________________________
-
+
### method `forward`
@@ -433,13 +474,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `BranchingGemmModule`
Torch model with some branching and skip connections.
-
+
### method `__init__`
@@ -449,7 +490,7 @@ __init__(input_output, activation_function)
______________________________________________________________________
-
+
### method `forward`
@@ -468,13 +509,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `UnivariateModule`
Torch model that calls univariate and shape functions of torch.
-
+
### method `__init__`
@@ -484,7 +525,7 @@ __init__(input_output, activation_function)
______________________________________________________________________
-
+
### method `forward`
@@ -503,13 +544,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `StepActivationModule`
Torch model implements a step function that needs Greater, Cast and Where.
-
+
### method `__init__`
@@ -519,7 +560,7 @@ __init__(input_output, activation_function)
______________________________________________________________________
-
+
### method `forward`
@@ -538,13 +579,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `NetWithConcatUnsqueeze`
Torch model to test the concat and unsqueeze operators.
-
+
### method `__init__`
@@ -554,7 +595,7 @@ __init__(activation_function, input_output, n_fc_layers)
______________________________________________________________________
-
+
### method `forward`
@@ -573,13 +614,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `MultiOpOnSingleInputConvNN`
Network that applies two quantized operations on a single input.
-
+
### method `__init__`
@@ -589,7 +630,7 @@ __init__(can_remove_input_tlu: bool)
______________________________________________________________________
-
+
### method `forward`
@@ -608,7 +649,7 @@ the output of the NN
______________________________________________________________________
-
+
## class `FCSeq`
@@ -616,7 +657,7 @@ Torch model that should generate MatMul->Add ONNX patterns.
This network generates additions with a constant scalar
-
+
### method `__init__`
@@ -626,7 +667,7 @@ __init__(input_output, act)
______________________________________________________________________
-
+
### method `forward`
@@ -645,7 +686,7 @@ the output of the NN
______________________________________________________________________
-
+
## class `FCSeqAddBiasVec`
@@ -653,7 +694,7 @@ Torch model that should generate MatMul->Add ONNX patterns.
This network tests the addition with a constant vector
-
+
### method `__init__`
@@ -663,7 +704,7 @@ __init__(input_output, act)
______________________________________________________________________
-
+
### method `forward`
@@ -682,13 +723,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `TinyCNN`
A very small CNN.
-
+
### method `__init__`
@@ -705,7 +746,7 @@ Create the tiny CNN with two conv layers.
______________________________________________________________________
-
+
### method `forward`
@@ -724,7 +765,7 @@ the output of the NN
______________________________________________________________________
-
+
## class `TinyQATCNN`
@@ -732,7 +773,7 @@ A very small QAT CNN to classify the sklearn digits data-set.
This class also allows pruning to a maximum of 10 active neurons, which should help keep the accumulator bit-width low.
-
+
### method `__init__`
@@ -752,7 +793,7 @@ Construct the CNN with a configurable number of classes.
______________________________________________________________________
-
+
### method `forward`
@@ -771,7 +812,7 @@ the output of the NN
______________________________________________________________________
-
+
### method `test_torch`
@@ -791,7 +832,7 @@ Test the network: measure accuracy on the test set.
______________________________________________________________________
-
+
### method `toggle_pruning`
@@ -807,13 +848,13 @@ Enable or remove pruning.
______________________________________________________________________
-
+
## class `SimpleQAT`
Torch model implements a step function that needs Greater, Cast and Where.
-
+
### method `__init__`
@@ -823,7 +864,7 @@ __init__(input_output, activation_function, n_bits=2, disable_bit_check=False)
______________________________________________________________________
-
+
### method `forward`
@@ -842,13 +883,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `QATTestModule`
Torch model that implements a simple non-uniform quantizer.
-
+
### method `__init__`
@@ -858,7 +899,7 @@ __init__(activation_function)
______________________________________________________________________
-
+
### method `forward`
@@ -877,13 +918,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `SingleMixNet`
-Torch model that with a single conv layer that produces the output, eg a blur filter.
+Torch model that with a single conv layer that produces the output, e.g., a blur filter.
-
+
### method `__init__`
@@ -893,7 +934,7 @@ __init__(use_conv, use_qat, inp_size, n_bits)
______________________________________________________________________
-
+
### method `forward`
@@ -912,7 +953,7 @@ the output of the NN
______________________________________________________________________
-
+
## class `DoubleQuantQATMixNet`
@@ -920,7 +961,7 @@ Torch model that with two different quantizers on the input.
Used to test that it keeps the input TLU.
-
+
### method `__init__`
@@ -930,7 +971,7 @@ __init__(use_conv, use_qat, inp_size, n_bits)
______________________________________________________________________
-
+
### method `forward`
@@ -949,13 +990,13 @@ the output of the NN
______________________________________________________________________
-
+
## class `TorchSum`
Torch model to test the ReduceSum ONNX operator in a leveled circuit.
-
+
### method `__init__`
@@ -972,7 +1013,7 @@ Initialize the module.
______________________________________________________________________
-
+
### method `forward`
@@ -992,13 +1033,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `TorchSumMod`
Torch model to test the ReduceSum ONNX operator in a circuit containing a PBS.
-
+
### method `__init__`
@@ -1015,7 +1056,7 @@ Initialize the module.
______________________________________________________________________
-
+
### method `forward`
@@ -1035,13 +1076,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `NetWithConstantsFoldedBeforeOps`
Torch QAT model that does not quantize the inputs.
-
+
### method `__init__`
@@ -1056,7 +1097,7 @@ __init__(
______________________________________________________________________
-
+
### method `forward`
@@ -1076,13 +1117,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `ShapeOperationsNet`
Torch QAT model that reshapes the input.
-
+
### method `__init__`
@@ -1092,7 +1133,7 @@ __init__(is_qat)
______________________________________________________________________
-
+
### method `forward`
@@ -1112,13 +1153,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `PaddingNet`
Torch QAT model that applies various padding patterns.
-
+
### method `__init__`
@@ -1128,7 +1169,7 @@ __init__()
______________________________________________________________________
-
+
### method `forward`
@@ -1148,13 +1189,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `QNNFashionMNIST`
A small quantized network with Brevitas for FashionMNIST classification.
-
+
### method `__init__`
@@ -1176,7 +1217,7 @@ Quantized Torch Model with Brevitas.
______________________________________________________________________
-
+
### method `forward`
@@ -1196,13 +1237,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `QuantCustomModel`
A small quantized network with Brevitas, trained on make_classification.
-
+
### method `__init__`
@@ -1230,7 +1271,7 @@ Quantized Torch Model with Brevitas.
______________________________________________________________________
-
+
### method `forward`
@@ -1250,13 +1291,13 @@ Forward pass.
______________________________________________________________________
-
+
## class `TorchCustomModel`
A small network with Brevitas, trained on make_classification.
-
+
### method `__init__`
@@ -1274,7 +1315,59 @@ Torch Model.
______________________________________________________________________
-
+
+
+### method `forward`
+
+```python
+forward(x)
+```
+
+Forward pass.
+
+**Args:**
+
+- `x` (torch.tensor): The input of the model.
+
+**Returns:**
+
+- `torch.tensor`: Output of the network.
+
+______________________________________________________________________
+
+
+
+## class `ConcatFancyIndexing`
+
+Concat with fancy indexing.
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ input_shape,
+ hidden_shape,
+ output_shape,
+ n_bits: int = 4,
+ n_blocks: int = 3
+) → None
+```
+
+Torch Model.
+
+**Args:**
+
+- `input_shape` (int): Input size
+- `output_shape` (int): Output size
+- `hidden_shape` (int): Hidden size
+- `n_bits` (int): Number of bits
+- `n_blocks` (int): Number of blocks
+
+______________________________________________________________________
+
+
### method `forward`
diff --git a/docs/developer-guide/api/concrete.ml.pytest.utils.md b/docs/developer-guide/api/concrete.ml.pytest.utils.md
index a5029de9b..0f582f8b9 100644
--- a/docs/developer-guide/api/concrete.ml.pytest.utils.md
+++ b/docs/developer-guide/api/concrete.ml.pytest.utils.md
@@ -12,7 +12,7 @@ Common functions or lists for test files, which can't be put in fixtures.
______________________________________________________________________
-
+
## function `get_random_extract_of_sklearn_models_and_datasets`
@@ -29,29 +29,30 @@ the sublist
______________________________________________________________________
-
+
## function `instantiate_model_generic`
```python
-instantiate_model_generic(model_class, **parameters)
+instantiate_model_generic(model_class, n_bits, **parameters)
```
Instantiate any Concrete ML model type.
**Args:**
-- `model_class` (class): The type of the model to instantiate
-- `parameters` (dict): Hyper-parameters for the model instantiation
+- `model_class` (class): The type of the model to instantiate.
+- `n_bits` (int): The number of quantization to use when initializing the model. For QNNs, default parameters are used based on whether `n_bits` is greater or smaller than 8.
+- `parameters` (dict): Hyper-parameters for the model instantiation. For QNNs, these parameters will override the matching default ones.
**Returns:**
-- `model_name` (str): The type of the model as a string
-- `model` (object): The model instance
+- `model_name` (str): The type of the model as a string.
+- `model` (object): The model instance.
______________________________________________________________________
-
+
## function `get_torchvision_dataset`
@@ -72,7 +73,7 @@ A torchvision data-sets.
______________________________________________________________________
-
+
## function `data_calibration_processing`
@@ -98,7 +99,7 @@ Reduce size of the given data-set.
______________________________________________________________________
-
+
## function `load_torch_model`
@@ -123,3 +124,52 @@ Load an object saved with torch.save() from a file or dict.
**Returns:**
- `torch.nn.Module`: A PyTorch or Brevitas network.
+
+______________________________________________________________________
+
+
+
+## function `values_are_equal`
+
+```python
+values_are_equal(value_1: Any, value_2: Any) → bool
+```
+
+Indicate if two values are equal.
+
+This method takes into account objects of type None, numpy.ndarray, numpy.floating, numpy.integer, numpy.random.RandomState or any instance that provides a `__eq__` method.
+
+**Args:**
+
+- `value_2` (Any): The first value to consider.
+- `value_1` (Any): The second value to consider.
+
+**Returns:**
+
+- `bool`: If the two values are equal.
+
+______________________________________________________________________
+
+
+
+## function `check_serialization`
+
+```python
+check_serialization(
+ object_to_serialize: Any,
+ expected_type: Type,
+ equal_method: Optional[Callable] = None,
+ check_str: bool = True
+)
+```
+
+Check that the given object can properly be serialized.
+
+This function serializes all objects using the `dump`, `dumps`, `load` and `loads` functions from Concrete ML. If the given object provides a `dump` and `dumps` method, they are also serialized using these.
+
+**Args:**
+
+- `object_to_serialize` (Any): The object to serialize.
+- `expected_type` (Type): The object's expected type.
+- `equal_method` (Optional\[Callable\]): The function to use to compare the two loaded objects. Default to `values_are_equal`.
+- `check_str` (bool): If the JSON strings should also be checked. Default to True.
diff --git a/docs/developer-guide/api/concrete.ml.quantization.base_quantized_op.md b/docs/developer-guide/api/concrete.ml.quantization.base_quantized_op.md
index 46da8d111..23ab81597 100644
--- a/docs/developer-guide/api/concrete.ml.quantization.base_quantized_op.md
+++ b/docs/developer-guide/api/concrete.ml.quantization.base_quantized_op.md
@@ -15,7 +15,7 @@ Base Quantized Op class that implements quantization for a float numpy op.
______________________________________________________________________
-
+
## class `QuantizedOp`
@@ -29,7 +29,7 @@ Base class for quantized ONNX ops implemented in numpy.
- `constant_inputs` (Optional\[Union\[Dict\[str, Any\], Dict\[int, Any\]\]\]): The constant tensors that are inputs to this op
- `input_quant_opts` (QuantizationOptions): Input quantizer options, determine the quantization that is applied to input tensors (that are not constants)
-
+
### method `__init__`
@@ -52,11 +52,11 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
-
+
### method `calibrate`
@@ -76,7 +76,7 @@ Create corresponding QuantizedArray for the output of the activation function.
______________________________________________________________________
-
+
### method `call_impl`
@@ -97,7 +97,7 @@ Call self.impl to centralize mypy bug workaround.
______________________________________________________________________
-
+
### method `can_fuse`
@@ -115,7 +115,75 @@ This function shall be overloaded by inheriting classes to test self.\_int_input
______________________________________________________________________
-
+
+
+### method `dump`
+
+```python
+dump(file: ) → None
+```
+
+Dump itself to a file.
+
+**Args:**
+
+- `file` (TextIO): The file to dump the serialized object into.
+
+______________________________________________________________________
+
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict
+```
+
+Dump itself to a dict.
+
+**Returns:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+______________________________________________________________________
+
+
+
+### method `dumps`
+
+```python
+dumps() → str
+```
+
+Dump itself to a string.
+
+**Returns:**
+
+- `metadata` (str): String of the serialized object.
+
+______________________________________________________________________
+
+
+
+### method `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+Load itself from a string.
+
+**Args:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+**Returns:**
+
+- `QuantizedOp`: The loaded object.
+
+______________________________________________________________________
+
+
### classmethod `must_quantize_input`
@@ -137,7 +205,7 @@ Quantized ops and numpy onnx ops take inputs and attributes. Inputs can be eithe
______________________________________________________________________
-
+
### classmethod `op_type`
@@ -153,7 +221,7 @@ Get the type of this operation.
______________________________________________________________________
-
+
### method `prepare_output`
@@ -175,7 +243,7 @@ The calibrate method needs to be called with sample data before using this funct
______________________________________________________________________
-
+
### method `q_impl`
@@ -199,15 +267,15 @@ Execute the quantized forward.
______________________________________________________________________
-
+
## class `QuantizedOpUnivariateOfEncrypted`
An univariate operator of an encrypted value.
-This operation is not really operating as a quantized operation. It is useful when the computations get fused into a TLU, as in eg Act(x) = x || (x + 42)).
+This operation is not really operating as a quantized operation. It is useful when the computations get fused into a TLU, as in e.g., Act(x) = x || (x + 42)).
-
+
### method `__init__`
@@ -230,11 +298,11 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
-
+
### method `calibrate`
@@ -254,7 +322,7 @@ Create corresponding QuantizedArray for the output of the activation function.
______________________________________________________________________
-
+
### method `call_impl`
@@ -275,7 +343,7 @@ Call self.impl to centralize mypy bug workaround.
______________________________________________________________________
-
+
### method `can_fuse`
@@ -293,7 +361,75 @@ This operation can be fused and computed in float when a single integer tensor g
______________________________________________________________________
-
+
+
+### method `dump`
+
+```python
+dump(file: ) → None
+```
+
+Dump itself to a file.
+
+**Args:**
+
+- `file` (TextIO): The file to dump the serialized object into.
+
+______________________________________________________________________
+
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict
+```
+
+Dump itself to a dict.
+
+**Returns:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+______________________________________________________________________
+
+
+
+### method `dumps`
+
+```python
+dumps() → str
+```
+
+Dump itself to a string.
+
+**Returns:**
+
+- `metadata` (str): String of the serialized object.
+
+______________________________________________________________________
+
+
+
+### method `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+Load itself from a string.
+
+**Args:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+**Returns:**
+
+- `QuantizedOp`: The loaded object.
+
+______________________________________________________________________
+
+
### classmethod `must_quantize_input`
@@ -315,7 +451,7 @@ Quantized ops and numpy onnx ops take inputs and attributes. Inputs can be eithe
______________________________________________________________________
-
+
### classmethod `op_type`
@@ -331,7 +467,7 @@ Get the type of this operation.
______________________________________________________________________
-
+
### method `prepare_output`
@@ -353,7 +489,7 @@ The calibrate method needs to be called with sample data before using this funct
______________________________________________________________________
-
+
### method `q_impl`
@@ -377,7 +513,7 @@ Execute the quantized forward.
______________________________________________________________________
-
+
## class `QuantizedMixingOp`
@@ -385,7 +521,7 @@ An operator that mixes (adds or multiplies) together encrypted inputs.
Mixing operators cannot be fused to TLUs.
-
+
### method `__init__`
@@ -409,11 +545,11 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
-
+
### method `calibrate`
@@ -433,7 +569,7 @@ Create corresponding QuantizedArray for the output of the activation function.
______________________________________________________________________
-
+
### method `call_impl`
@@ -454,7 +590,7 @@ Call self.impl to centralize mypy bug workaround.
______________________________________________________________________
-
+
### method `can_fuse`
@@ -472,7 +608,7 @@ Mixing operations cannot be fused since it must be performed over integer tensor
______________________________________________________________________
-
+
### method `cnp_round`
@@ -493,7 +629,75 @@ Round the input array to the specified number of bits.
______________________________________________________________________
-
+
+
+### method `dump`
+
+```python
+dump(file: ) → None
+```
+
+Dump itself to a file.
+
+**Args:**
+
+- `file` (TextIO): The file to dump the serialized object into.
+
+______________________________________________________________________
+
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict
+```
+
+Dump itself to a dict.
+
+**Returns:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+______________________________________________________________________
+
+
+
+### method `dumps`
+
+```python
+dumps() → str
+```
+
+Dump itself to a string.
+
+**Returns:**
+
+- `metadata` (str): String of the serialized object.
+
+______________________________________________________________________
+
+
+
+### method `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+Load itself from a string.
+
+**Args:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+**Returns:**
+
+- `QuantizedOp`: The loaded object.
+
+______________________________________________________________________
+
+
### method `make_output_quant_parameters`
@@ -519,7 +723,7 @@ Build a quantized array from quantized integer results of the op and quantizatio
______________________________________________________________________
-
+
### classmethod `must_quantize_input`
@@ -541,7 +745,7 @@ Quantized ops and numpy onnx ops take inputs and attributes. Inputs can be eithe
______________________________________________________________________
-
+
### classmethod `op_type`
@@ -557,7 +761,7 @@ Get the type of this operation.
______________________________________________________________________
-
+
### method `prepare_output`
@@ -579,7 +783,7 @@ The calibrate method needs to be called with sample data before using this funct
______________________________________________________________________
-
+
### method `q_impl`
diff --git a/docs/developer-guide/api/concrete.ml.quantization.post_training.md b/docs/developer-guide/api/concrete.ml.quantization.post_training.md
index 4d4d7bba7..510187483 100644
--- a/docs/developer-guide/api/concrete.ml.quantization.post_training.md
+++ b/docs/developer-guide/api/concrete.ml.quantization.post_training.md
@@ -130,7 +130,7 @@ Following https://arxiv.org/abs/1712.05877 guidelines.
______________________________________________________________________
-
+
## class `PostTrainingAffineQuantization`
@@ -229,7 +229,7 @@ Following https://arxiv.org/abs/1712.05877 guidelines.
______________________________________________________________________
-
+
## class `PostTrainingQATImporter`
diff --git a/docs/developer-guide/api/concrete.ml.quantization.quantized_module.md b/docs/developer-guide/api/concrete.ml.quantization.quantized_module.md
index c96dcac65..56b64ef1c 100644
--- a/docs/developer-guide/api/concrete.ml.quantization.quantized_module.md
+++ b/docs/developer-guide/api/concrete.ml.quantization.quantized_module.md
@@ -13,13 +13,13 @@ QuantizedModule API.
______________________________________________________________________
-
+
## class `QuantizedModule`
Inference for a quantized model.
-
+
### method `__init__`
@@ -27,7 +27,8 @@ Inference for a quantized model.
__init__(
ordered_module_input_names: Iterable[str] = None,
ordered_module_output_names: Iterable[str] = None,
- quant_layers_dict: Dict[str, Tuple[Tuple[str, ], QuantizedOp]] = None
+ quant_layers_dict: Dict[str, Tuple[Tuple[str, ], QuantizedOp]] = None,
+ onnx_model: ModelProto = None
)
```
@@ -65,7 +66,7 @@ Get the post-processing parameters.
______________________________________________________________________
-
+
### method `bitwidth_and_range_report`
@@ -81,7 +82,7 @@ Report the ranges and bit-widths for layers that mix encrypted integer values.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -97,7 +98,7 @@ Check if the quantized module is compiled.
______________________________________________________________________
-
+
### method `compile`
@@ -131,7 +132,7 @@ Compile the module's forward function.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -151,7 +152,55 @@ Take the last layer q_out and use its de-quant function.
______________________________________________________________________
-
+
+
+### method `dump`
+
+```python
+dump(file: ) → None
+```
+
+Dump itself to a file.
+
+**Args:**
+
+- `file` (TextIO): The file to dump the serialized object into.
+
+______________________________________________________________________
+
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict
+```
+
+Dump itself to a dict.
+
+**Returns:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+______________________________________________________________________
+
+
+
+### method `dumps`
+
+```python
+dumps() → str
+```
+
+Dump itself to a string.
+
+**Returns:**
+
+- `metadata` (str): String of the serialized object.
+
+______________________________________________________________________
+
+
### method `forward`
@@ -179,7 +228,27 @@ This method executes the forward pass in the clear, with simulation or in FHE. I
______________________________________________________________________
-
+
+
+### method `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+Load itself from a string.
+
+**Args:**
+
+- `metadata` (Dict): Dict of serialized objects.
+
+**Returns:**
+
+- `QuantizedModule`: The loaded object.
+
+______________________________________________________________________
+
+
### method `post_processing`
@@ -201,7 +270,7 @@ For quantized modules, there is no post-processing step but the method is kept t
______________________________________________________________________
-
+
### method `quantize_input`
@@ -221,7 +290,7 @@ Take the inputs in fp32 and quantize it using the learned quantization parameter
______________________________________________________________________
-
+
### method `quantized_forward`
@@ -245,7 +314,7 @@ Forward function for the FHE circuit.
______________________________________________________________________
-
+
### method `set_inputs_quantization_parameters`
diff --git a/docs/developer-guide/api/concrete.ml.quantization.quantized_ops.md b/docs/developer-guide/api/concrete.ml.quantization.quantized_ops.md
index 885ec9b9d..288836e0c 100644
--- a/docs/developer-guide/api/concrete.ml.quantization.quantized_ops.md
+++ b/docs/developer-guide/api/concrete.ml.quantization.quantized_ops.md
@@ -22,7 +22,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -40,7 +40,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -58,7 +58,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -76,7 +76,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -94,7 +94,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -112,7 +112,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -130,7 +130,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -148,7 +148,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -166,7 +166,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -184,7 +184,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -202,7 +202,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -222,7 +222,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -255,7 +255,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -302,7 +302,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -336,7 +336,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -385,7 +385,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -403,7 +403,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -421,7 +421,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -439,7 +439,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -457,7 +457,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -475,7 +475,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -506,7 +506,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -597,7 +597,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -661,7 +661,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -708,7 +708,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -772,7 +772,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -839,7 +839,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -859,7 +859,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -894,7 +894,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -929,7 +929,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -964,7 +964,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -999,7 +999,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1009,7 +1009,7 @@ ______________________________________________________________________
Or operator ||.
-This operation is not really working as a quantized operation. It just works when things got fused, as in eg Act(x) = x || (x + 42))
+This operation is not really working as a quantized operation. It just works when things got fused, as in e.g., Act(x) = x || (x + 42))
______________________________________________________________________
@@ -1019,7 +1019,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1029,7 +1029,7 @@ ______________________________________________________________________
Div operator /.
-This operation is not really working as a quantized operation. It just works when things got fused, as in eg Act(x) = 1000 / (x + 42))
+This operation is not really working as a quantized operation. It just works when things got fused, as in e.g., Act(x) = 1000 / (x + 42))
______________________________________________________________________
@@ -1039,7 +1039,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1059,7 +1059,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1079,7 +1079,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1128,7 +1128,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1146,7 +1146,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1235,7 +1235,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1297,7 +1297,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1315,7 +1315,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1354,7 +1354,7 @@ Construct the Brevitas quantization operator.
- `input_quant_opts` (Optional\[QuantizationOptions\]): Options for the input quantizer. Default to None. attrs (dict):
- `rounding_mode` (str): Rounding mode (default and only accepted option is "ROUND")
- `signed` (int): Whether this op quantizes to signed integers (default 1),
-- `narrow` (int): Whether this op quantizes to a narrow range of integers eg \[-2**n_bits-1 .. 2**n_bits-1\] (default 0),
+- `narrow` (int): Whether this op quantizes to a narrow range of integers e.g., \[-2**n_bits-1 .. 2**n_bits-1\] (default 0),
______________________________________________________________________
@@ -1364,7 +1364,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1428,7 +1428,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1488,7 +1488,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1506,7 +1506,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1524,7 +1524,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1542,7 +1542,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1560,7 +1560,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1578,7 +1578,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1638,7 +1638,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1698,7 +1698,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1758,7 +1758,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1807,7 +1807,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1845,7 +1845,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
@@ -1894,7 +1894,7 @@ Get the names of encrypted integer tensors that are used by this op.
**Returns:**
-- `List[str]`: the names of the tensors
+- `Set[str]`: the names of the tensors
______________________________________________________________________
diff --git a/docs/developer-guide/api/concrete.ml.quantization.quantizers.md b/docs/developer-guide/api/concrete.ml.quantization.quantizers.md
index 45c135269..1af7c6ace 100644
--- a/docs/developer-guide/api/concrete.ml.quantization.quantizers.md
+++ b/docs/developer-guide/api/concrete.ml.quantization.quantizers.md
@@ -12,7 +12,7 @@ Quantization utilities for a numpy array/tensor.
______________________________________________________________________
-
+
## function `fill_from_kwargs`
@@ -39,7 +39,7 @@ Fill a parameter set structure from kwargs parameters.
______________________________________________________________________
-
+
## class `QuantizationOptions`
@@ -47,7 +47,7 @@ Options for quantization.
Determines the number of bits for quantization and the method of quantization of the values. Signed quantization allows negative quantized values. Symmetric quantization assumes the float values are distributed symmetrically around x=0 and assigns signed values around 0 to the float values. QAT (quantization aware training) quantization assumes the values are already quantized, taking a discrete set of values, and assigns these values to integers, computing only the scale.
-
+
### method `__init__`
@@ -72,7 +72,7 @@ Get a copy of the quantization parameters.
______________________________________________________________________
-
+
### method `copy_opts`
@@ -88,23 +88,23 @@ Copy the options from a different structure.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]')
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -116,11 +116,11 @@ Dump itself to a dict.
**Returns:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -132,11 +132,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `is_equal`
@@ -157,27 +157,7 @@ Compare two quantization options sets.
______________________________________________________________________
-
-
-### method `load`
-
-```python
-load(file: 'IO[str]') → QuantizationOptions
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `QuantizationOptions`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `load_dict`
@@ -189,35 +169,15 @@ Load itself from a string.
**Args:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
**Returns:**
-- `QuantizationOptions`: the loaded object
+- `QuantizationOptions`: The loaded object.
______________________________________________________________________
-
-
-### method `loads`
-
-```python
-loads(metadata: 'str') → QuantizationOptions
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `QuantizationOptions`: the loaded object
-
-______________________________________________________________________
-
-
+
## class `MinMaxQuantizationStats`
@@ -225,7 +185,7 @@ Calibration set statistics.
This class stores the statistics for the calibration set or for a calibration data batch. Currently we only store min/max to determine the quantization range. The min/max are computed from the calibration set.
-
+
### method `__init__`
@@ -249,7 +209,7 @@ Get a copy of the calibration set statistics.
______________________________________________________________________
-
+
### method `check_is_uniform_quantized`
@@ -271,7 +231,7 @@ Determines whether the values represented by this QuantizedArray show a quantize
______________________________________________________________________
-
+
### method `compute_quantization_stats`
@@ -287,7 +247,7 @@ Compute the calibration set quantization statistics.
______________________________________________________________________
-
+
### method `copy_stats`
@@ -303,23 +263,23 @@ Copy the statistics from a different structure.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]')
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -331,11 +291,11 @@ Dump itself to a dict.
**Returns:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -347,31 +307,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
-
-### method `load`
-
-```python
-load(file: 'IO[str]') → MinMaxQuantizationStats
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `MinMaxQuantizationStats`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `load_dict`
@@ -383,35 +323,15 @@ Load itself from a string.
**Args:**
-- `metadata` (Dict): dict of serialized object
-
-**Returns:**
-
-- `QuantizationOptions`: the loaded object
-
-______________________________________________________________________
-
-
-
-### method `loads`
-
-```python
-loads(metadata: 'str') → MinMaxQuantizationStats
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict): Dict of serialized objects.
**Returns:**
-- `MinMaxQuantizationStats`: the loaded object
+- `QuantizationOptions`: The loaded object.
______________________________________________________________________
-
+
## class `UniformQuantizationParameters`
@@ -419,7 +339,7 @@ Quantization parameters for uniform quantization.
This class stores the parameters used for quantizing real values to discrete integer values. The parameters are computed from quantization options and quantization statistics.
-
+
### method `__init__`
@@ -443,7 +363,7 @@ Get a copy of the quantization parameters.
______________________________________________________________________
-
+
### method `compute_quantization_parameters`
@@ -463,7 +383,7 @@ Compute the quantization parameters.
______________________________________________________________________
-
+
### method `copy_params`
@@ -479,23 +399,23 @@ Copy the parameters from a different structure.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]')
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -507,11 +427,11 @@ Dump itself to a dict.
**Returns:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -523,31 +443,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
-
-### method `load`
-
-```python
-load(file: 'IO[str]') → UniformQuantizationParameters
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `UniformQuantizationParameters`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `load_dict`
@@ -559,35 +459,15 @@ Load itself from a string.
**Args:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
**Returns:**
-- `UniformQuantizationParameters`: the loaded object
+- `UniformQuantizationParameters`: The loaded object.
______________________________________________________________________
-
-
-### method `loads`
-
-```python
-loads(metadata: 'str') → UniformQuantizationParameters
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `UniformQuantizationParameters`: the loaded object
-
-______________________________________________________________________
-
-
+
## class `UniformQuantizer`
@@ -601,7 +481,7 @@ Contains all information necessary for uniform quantization and provides quantiz
- `stats` (Optional\[MinMaxQuantizationStats\]): Quantization batch statistics set
- `params` (Optional\[UniformQuantizationParameters\]): Quantization parameters set (scale, zero-point)
-
+
### method `__init__`
@@ -646,7 +526,7 @@ Get a copy of the calibration set statistics.
______________________________________________________________________
-
+
### method `check_is_uniform_quantized`
@@ -668,7 +548,7 @@ Determines whether the values represented by this QuantizedArray show a quantize
______________________________________________________________________
-
+
### method `compute_quantization_parameters`
@@ -688,7 +568,7 @@ Compute the quantization parameters.
______________________________________________________________________
-
+
### method `compute_quantization_stats`
@@ -704,7 +584,7 @@ Compute the calibration set quantization statistics.
______________________________________________________________________
-
+
### method `copy_opts`
@@ -720,7 +600,7 @@ Copy the options from a different structure.
______________________________________________________________________
-
+
### method `copy_params`
@@ -736,7 +616,7 @@ Copy the parameters from a different structure.
______________________________________________________________________
-
+
### method `copy_stats`
@@ -752,7 +632,7 @@ Copy the statistics from a different structure.
______________________________________________________________________
-
+
### method `dequant`
@@ -772,23 +652,23 @@ De-quantize values.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -800,11 +680,11 @@ Dump itself to a dict.
**Returns:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -816,11 +696,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `is_equal`
@@ -841,27 +721,7 @@ Compare two quantization options sets.
______________________________________________________________________
-
-
-### method `load`
-
-```python
-load(file: 'IO[str]') → UniformQuantizer
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `UniformQuantizer`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `load_dict`
@@ -873,35 +733,15 @@ Load itself from a string.
**Args:**
-- `metadata` (Dict): dict of serialized object
-
-**Returns:**
-
-- `UniformQuantizer`: the loaded object
-
-______________________________________________________________________
-
-
-
-### method `loads`
-
-```python
-loads(metadata: 'str') → UniformQuantizer
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict): Dict of serialized objects.
**Returns:**
-- `UniformQuantizer`: the loaded object
+- `UniformQuantizer`: The loaded object.
______________________________________________________________________
-
+
### method `quant`
@@ -921,7 +761,7 @@ Quantize values.
______________________________________________________________________
-
+
## class `QuantizedArray`
@@ -941,7 +781,7 @@ See https://arxiv.org/abs/1712.05877.
- `params` (Optional\[UniformQuantizationParameters\]): Quantization parameters set (scale, zero-point)
- `kwargs`: Any member of the options, stats, params sets as a key-value pair. The parameter sets need to be completely parametrized if their members appear in kwargs.
-
+
### method `__init__`
@@ -959,7 +799,7 @@ __init__(
______________________________________________________________________
-
+
### method `dequant`
@@ -975,23 +815,23 @@ De-quantize self.qvalues.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -1003,11 +843,11 @@ Dump itself to a dict.
**Returns:**
-- `metadata` (Dict): dict of serialized object
+- `metadata` (Dict): Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -1019,31 +859,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
-
-______________________________________________________________________
-
-
-
-### method `load`
-
-```python
-load(file: 'IO[str]') → QuantizedArray
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `QuantizedArray`: the loaded object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `load_dict`
@@ -1055,35 +875,15 @@ Load itself from a string.
**Args:**
-- `metadata` (Dict): dict of serialized object
-
-**Returns:**
-
-- `QuantizedArray`: the loaded object
-
-______________________________________________________________________
-
-
-
-### method `loads`
-
-```python
-loads(metadata: 'str') → QuantizedArray
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict): Dict of serialized objects.
**Returns:**
-- `QuantizedArray`: the loaded object
+- `QuantizedArray`: The loaded object.
______________________________________________________________________
-
+
### method `quant`
@@ -1099,7 +899,7 @@ Quantize self.values.
______________________________________________________________________
-
+
### method `update_quantized_values`
@@ -1119,7 +919,7 @@ Update qvalues to get their corresponding values using the related quantized par
______________________________________________________________________
-
+
### method `update_values`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.base.md b/docs/developer-guide/api/concrete.ml.sklearn.base.md
index 8967892db..fc50dd82c 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.base.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.base.md
@@ -83,7 +83,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -99,7 +99,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -115,7 +115,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -149,7 +149,7 @@ Compile the model.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -171,23 +171,23 @@ This step ensures that the fit method has been called.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -199,11 +199,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -215,11 +215,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -242,7 +242,7 @@ The fitted estimator.
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -269,7 +269,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -291,27 +291,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -323,35 +303,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
+
### method `post_processing`
@@ -375,7 +335,7 @@ For some simple models such a linear regression, there is no post-processing ste
______________________________________________________________________
-
+
### method `predict`
@@ -399,7 +359,7 @@ Predict values for X, in FHE or in the clear.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -421,7 +381,7 @@ This step ensures that the fit method has been called.
______________________________________________________________________
-
+
## class `BaseClassifier`
@@ -429,7 +389,7 @@ Base class for linear and tree-based classifiers in Concrete ML.
This class inherits from BaseEstimator and modifies some of its methods in order to align them with classifier behaviors. This notably include applying a sigmoid/softmax post-processing to the predicted values as well as handling a mapping of classes in case they are not ordered.
-
+
### method `__init__`
@@ -483,7 +443,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -499,7 +459,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -515,7 +475,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -549,7 +509,7 @@ Compile the model.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -571,23 +531,23 @@ This step ensures that the fit method has been called.
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -599,11 +559,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -615,11 +575,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -629,7 +589,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -656,7 +616,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -678,27 +638,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -710,35 +650,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
+
### method `post_processing`
@@ -748,7 +668,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -761,7 +681,7 @@ predict(
______________________________________________________________________
-
+
### method `predict_proba`
@@ -785,7 +705,7 @@ Predict class probabilities.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -807,13 +727,13 @@ This step ensures that the fit method has been called.
______________________________________________________________________
-
+
## class `QuantizedTorchEstimatorMixin`
Mixin that provides quantization for a torch module and follows the Estimator API.
-
+
### method `__init__`
@@ -889,7 +809,7 @@ Get the output quantizers.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -905,7 +825,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -921,7 +841,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -939,7 +859,7 @@ compile(
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -949,23 +869,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -977,11 +897,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -993,11 +913,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -1022,7 +942,7 @@ The fitted estimator.
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -1053,7 +973,7 @@ The Concrete ML and equivalent skorch fitted estimators.
______________________________________________________________________
-
+
### method `get_params`
@@ -1075,7 +995,7 @@ This method is overloaded in order to make sure that auto-computed parameters ar
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -1085,27 +1005,7 @@ get_sklearn_params(deep: 'bool' = True) → Dict
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -1117,35 +1017,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
+
### method `post_processing`
@@ -1155,7 +1035,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -1179,7 +1059,7 @@ Predict values for X, in FHE or in the clear.
______________________________________________________________________
-
+
### method `prune`
@@ -1207,7 +1087,7 @@ A new pruned copy of the Neural Network model.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -1217,7 +1097,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `BaseTreeEstimatorMixin`
@@ -1225,7 +1105,7 @@ Mixin class for tree-based estimators.
This class inherits from sklearn.base.BaseEstimator in order to have access to scikit-learn's `get_params` and `set_params` methods.
-
+
### method `__init__`
@@ -1285,7 +1165,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -1301,7 +1181,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -1317,7 +1197,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -1327,7 +1207,7 @@ compile(*args, **kwargs) → Circuit
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -1337,23 +1217,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -1365,11 +1245,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -1381,11 +1261,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -1395,7 +1275,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -1422,7 +1302,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -1444,27 +1324,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -1476,35 +1336,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `post_processing`
@@ -1514,7 +1354,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -1527,7 +1367,7 @@ predict(
______________________________________________________________________
-
+
### method `quantize_input`
@@ -1537,7 +1377,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `BaseTreeRegressorMixin`
@@ -1545,7 +1385,7 @@ Mixin class for tree-based regressors.
This class is used to create a tree-based regressor class that inherits from sklearn.base.RegressorMixin, which essentially gives access to scikit-learn's `score` method for regressors.
-
+
### method `__init__`
@@ -1605,7 +1445,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -1621,7 +1461,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -1637,7 +1477,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -1647,7 +1487,7 @@ compile(*args, **kwargs) → Circuit
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -1657,23 +1497,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -1685,11 +1525,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -1701,11 +1541,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -1715,7 +1555,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -1742,7 +1582,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -1764,27 +1604,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -1796,35 +1616,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `post_processing`
@@ -1834,7 +1634,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -1847,7 +1647,7 @@ predict(
______________________________________________________________________
-
+
### method `quantize_input`
@@ -1857,7 +1657,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `BaseTreeClassifierMixin`
@@ -1867,7 +1667,7 @@ This class is used to create a tree-based classifier class that inherits from sk
Additionally, this class adjusts some of the tree-based base class's methods in order to make them compliant with classification workflows.
-
+
### method `__init__`
@@ -1921,7 +1721,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -1937,7 +1737,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -1953,7 +1753,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -1963,7 +1763,7 @@ compile(*args, **kwargs) → Circuit
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -1973,23 +1773,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -2001,11 +1801,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -2017,11 +1817,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -2031,7 +1831,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -2058,7 +1858,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -2080,27 +1880,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -2112,35 +1892,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
+
### method `post_processing`
@@ -2150,7 +1910,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -2163,7 +1923,7 @@ predict(
______________________________________________________________________
-
+
### method `predict_proba`
@@ -2187,7 +1947,7 @@ Predict class probabilities.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -2197,7 +1957,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `SklearnLinearModelMixin`
@@ -2205,7 +1965,7 @@ A Mixin class for sklearn linear models with FHE.
This class inherits from sklearn.base.BaseEstimator in order to have access to scikit-learn's `get_params` and `set_params` methods.
-
+
### method `__init__`
@@ -2267,7 +2027,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -2283,7 +2043,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -2299,7 +2059,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -2333,7 +2093,7 @@ Compile the model.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -2343,23 +2103,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -2371,11 +2131,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -2387,11 +2147,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -2401,7 +2161,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -2428,7 +2188,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -2450,27 +2210,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -2482,35 +2222,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `post_processing`
@@ -2534,7 +2254,7 @@ For some simple models such a linear regression, there is no post-processing ste
______________________________________________________________________
-
+
### method `predict`
@@ -2558,7 +2278,7 @@ Predict values for X, in FHE or in the clear.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -2568,7 +2288,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `SklearnLinearRegressorMixin`
@@ -2576,7 +2296,7 @@ A Mixin class for sklearn linear regressors with FHE.
This class is used to create a linear regressor class that inherits from sklearn.base.RegressorMixin, which essentially gives access to scikit-learn's `score` method for regressors.
-
+
### method `__init__`
@@ -2638,7 +2358,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -2654,7 +2374,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -2670,7 +2390,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -2704,7 +2424,7 @@ Compile the model.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -2714,23 +2434,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -2742,11 +2462,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -2758,11 +2478,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -2772,7 +2492,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -2799,7 +2519,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -2821,27 +2541,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -2853,35 +2553,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### method `post_processing`
@@ -2905,7 +2585,7 @@ For some simple models such a linear regression, there is no post-processing ste
______________________________________________________________________
-
+
### method `predict`
@@ -2929,7 +2609,7 @@ Predict values for X, in FHE or in the clear.
______________________________________________________________________
-
+
### method `quantize_input`
@@ -2939,7 +2619,7 @@ quantize_input(X: 'ndarray') → ndarray
______________________________________________________________________
-
+
## class `SklearnLinearClassifierMixin`
@@ -2949,7 +2629,7 @@ This class is used to create a linear classifier class that inherits from sklear
Additionally, this class adjusts some of the tree-based base class's methods in order to make them compliant with classification workflows.
-
+
### method `__init__`
@@ -3003,7 +2683,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `check_model_is_compiled`
@@ -3019,7 +2699,7 @@ Check if the model is compiled.
______________________________________________________________________
-
+
### method `check_model_is_fitted`
@@ -3035,7 +2715,7 @@ Check if the model is fitted.
______________________________________________________________________
-
+
### method `compile`
@@ -3069,7 +2749,7 @@ Compile the model.
______________________________________________________________________
-
+
### method `decision_function`
@@ -3093,7 +2773,7 @@ Predict confidence scores.
______________________________________________________________________
-
+
### method `dequantize_output`
@@ -3103,23 +2783,23 @@ dequantize_output(q_y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `dump`
```python
-dump(file: 'IO[str]') → None
+dump(file: 'TextIO') → None
```
Dump itself to a file.
**Args:**
-- `file` (IO\[str\]): file of where to dump.
+- `file` (TextIO): The file to dump the serialized object into.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -3131,11 +2811,11 @@ Dump the object as a dict.
**Returns:**
-- `Dict[str, Any]`: a dict representing the object
+- `Dict[str, Any]`: Dict of serialized objects.
______________________________________________________________________
-
+
### method `dumps`
@@ -3147,11 +2827,11 @@ Dump itself to a string.
**Returns:**
-- `metadata` (str): string of serialized object
+- `metadata` (str): String of the serialized object.
______________________________________________________________________
-
+
### method `fit`
@@ -3161,7 +2841,7 @@ fit(X: 'Data', y: 'Target', **fit_parameters)
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -3188,7 +2868,7 @@ The Concrete ML and float equivalent fitted estimators.
______________________________________________________________________
-
+
### method `get_sklearn_params`
@@ -3210,27 +2890,7 @@ This method is used to instantiate a scikit-learn model using the Concrete ML mo
______________________________________________________________________
-
-
-### classmethod `load`
-
-```python
-load(file: 'IO[str]') → BaseEstimator
-```
-
-Load itself from a file.
-
-**Args:**
-
-- `file` (IO\[str\]): file of serialized object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
+
### classmethod `load_dict`
@@ -3242,35 +2902,15 @@ Load itself from a dict.
**Args:**
-- `metadata` (Dict\[str, Any\]): dict of metadata of the object
-
-**Returns:**
-
-- `BaseEstimator`: the loaded object
-
-______________________________________________________________________
-
-
-
-### classmethod `loads`
-
-```python
-loads(metadata: 'str') → BaseEstimator
-```
-
-Load itself from a string.
-
-**Args:**
-
-- `metadata` (str): serialized object
+- `metadata` (Dict\[str, Any\]): Dict of serialized objects.
**Returns:**
-- `BaseEstimator`: the loaded object
+- `BaseEstimator`: The loaded object.
______________________________________________________________________
-
+
### method `post_processing`
@@ -3280,7 +2920,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -3293,7 +2933,7 @@ predict(
______________________________________________________________________
-
+
### method `predict_proba`
@@ -3306,7 +2946,7 @@ predict_proba(
______________________________________________________________________
-
+
### method `quantize_input`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.glm.md b/docs/developer-guide/api/concrete.ml.sklearn.glm.md
index e7a487c71..4a0e5e320 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.glm.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.glm.md
@@ -6,14 +6,9 @@
Implement sklearn's Generalized Linear Models (GLM).
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `PoissonRegressor`
@@ -27,7 +22,7 @@ A Poisson regression model with FHE.
For more details on PoissonRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PoissonRegressor.html
-
+
### method `__init__`
@@ -89,7 +84,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -99,7 +94,7 @@ dump_dict() → Dict
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -109,7 +104,7 @@ load_dict(metadata: 'Dict')
______________________________________________________________________
-
+
### method `post_processing`
@@ -119,7 +114,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -132,7 +127,7 @@ predict(
______________________________________________________________________
-
+
## class `GammaRegressor`
@@ -146,7 +141,7 @@ A Gamma regression model with FHE.
For more details on GammaRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.GammaRegressor.html
-
+
### method `__init__`
@@ -208,7 +203,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -218,7 +213,7 @@ dump_dict() → Dict
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -228,7 +223,7 @@ load_dict(metadata: 'Dict')
______________________________________________________________________
-
+
### method `post_processing`
@@ -238,7 +233,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
@@ -251,7 +246,7 @@ predict(
______________________________________________________________________
-
+
## class `TweedieRegressor`
@@ -265,7 +260,7 @@ A Tweedie regression model with FHE.
For more details on TweedieRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.TweedieRegressor.html
-
+
### method `__init__`
@@ -329,7 +324,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -339,7 +334,7 @@ dump_dict() → Dict
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -349,7 +344,7 @@ load_dict(metadata: 'Dict')
______________________________________________________________________
-
+
### method `post_processing`
@@ -359,7 +354,7 @@ post_processing(y_preds: 'ndarray') → ndarray
______________________________________________________________________
-
+
### method `predict`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.linear_model.md b/docs/developer-guide/api/concrete.ml.sklearn.linear_model.md
index 9bf211cd8..27cf31dd6 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.linear_model.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.linear_model.md
@@ -6,14 +6,9 @@
Implement sklearn linear model.
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `LinearRegression`
@@ -27,7 +22,7 @@ A linear regression model with FHE.
For more details on LinearRegression please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
-
+
### method `__init__`
@@ -88,7 +83,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -98,7 +93,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -108,7 +103,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `ElasticNet`
@@ -122,7 +117,7 @@ An ElasticNet regression model with FHE.
For more details on ElasticNet please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.html
-
+
### method `__init__`
@@ -190,7 +185,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -200,7 +195,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -210,7 +205,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `Lasso`
@@ -224,7 +219,7 @@ A Lasso regression model with FHE.
For more details on Lasso please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html
-
+
### method `__init__`
@@ -291,7 +286,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -301,7 +296,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -311,7 +306,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `Ridge`
@@ -325,7 +320,7 @@ A Ridge regression model with FHE.
For more details on Ridge please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html
-
+
### method `__init__`
@@ -390,7 +385,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -400,7 +395,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -410,7 +405,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `LogisticRegression`
@@ -424,7 +419,7 @@ A logistic regression model with FHE.
For more details on LogisticRegression please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html
-
+
### method `__init__`
@@ -495,7 +490,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -505,7 +500,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.qnn.md b/docs/developer-guide/api/concrete.ml.sklearn.qnn.md
index b4a634ba3..0a9dbd295 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.qnn.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.qnn.md
@@ -9,10 +9,12 @@ Scikit-learn interface for fully-connected quantized neural networks.
## **Global Variables**
- **QNN_AUTO_KWARGS**
+- **OPTIONAL_MODULE_PARAMS**
+- **ATTRIBUTE_PREFIXES**
______________________________________________________________________
-
+
## class `NeuralNetRegressor`
@@ -22,7 +24,7 @@ This class wraps a quantized neural network implemented using Torch tools as a s
Inputs and targets that are float64 will be casted to float32 before training as Torch does not handle float64 types properly. Thus should not have a significant impact on the model's performances. An error is raised if these values are not floating points.
-
+
### method `__init__`
@@ -118,7 +120,17 @@ Get the output quantizers.
______________________________________________________________________
-
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict[str, Any]
+```
+
+______________________________________________________________________
+
+
### method `fit`
@@ -133,7 +145,7 @@ fit(
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -148,7 +160,17 @@ fit_benchmark(
______________________________________________________________________
-
+
+
+### classmethod `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+______________________________________________________________________
+
+
### method `predict`
@@ -161,7 +183,7 @@ predict(
______________________________________________________________________
-
+
### method `predict_proba`
@@ -174,7 +196,7 @@ predict_proba(
______________________________________________________________________
-
+
## class `NeuralNetClassifier`
@@ -184,7 +206,7 @@ This class wraps a quantized neural network implemented using Torch tools as a s
Inputs that are float64 will be casted to float32 before training as Torch does not handle float64 types properly. Thus should not have a significant impact on the model's performances. If the targets are integers of lower bit-width, they will be safely casted to int64. Else, an error is raised.
-
+
### method `__init__`
@@ -285,7 +307,17 @@ Get the output quantizers.
______________________________________________________________________
-
+
+
+### method `dump_dict`
+
+```python
+dump_dict() → Dict[str, Any]
+```
+
+______________________________________________________________________
+
+
### method `fit`
@@ -300,7 +332,7 @@ fit(
______________________________________________________________________
-
+
### method `fit_benchmark`
@@ -315,7 +347,17 @@ fit_benchmark(
______________________________________________________________________
-
+
+
+### classmethod `load_dict`
+
+```python
+load_dict(metadata: Dict)
+```
+
+______________________________________________________________________
+
+
### method `predict`
@@ -328,7 +370,7 @@ predict(
______________________________________________________________________
-
+
### method `predict_proba`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.qnn_module.md b/docs/developer-guide/api/concrete.ml.sklearn.qnn_module.md
index 23e2c5f8e..b4ffca6ff 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.qnn_module.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.qnn_module.md
@@ -12,7 +12,7 @@ Sparse Quantized Neural Network torch module.
______________________________________________________________________
-
+
## class `SparseQuantNeuralNetwork`
@@ -20,23 +20,23 @@ Sparse Quantized Neural Network.
This class implements an MLP that is compatible with FHE constraints. The weights and activations are quantized to low bit-width and pruning is used to ensure accumulators do not surpass an user-provided accumulator bit-width. The number of classes and number of layers are specified by the user, as well as the breadth of the network
-
+
### method `__init__`
```python
__init__(
- input_dim,
- n_layers,
- n_outputs,
- n_hidden_neurons_multiplier=4,
- n_w_bits=3,
- n_a_bits=3,
- n_accum_bits=8,
- n_prune_neurons_percentage=0.0,
- activation_function=,
- quant_narrow=False,
- quant_signed=True
+ input_dim: int,
+ n_layers: int,
+ n_outputs: int,
+ n_hidden_neurons_multiplier: int = 4,
+ n_w_bits: int = 3,
+ n_a_bits: int = 3,
+ n_accum_bits: int = 8,
+ n_prune_neurons_percentage: float = 0.0,
+ activation_function: Type = ,
+ quant_narrow: bool = False,
+ quant_signed: bool = True
)
```
@@ -44,25 +44,25 @@ Sparse Quantized Neural Network constructor.
**Args:**
-- `input_dim`: Number of dimensions of the input data
-- `n_layers`: Number of linear layers for this network
-- `n_outputs`: Number of output classes or regression targets
-- `n_w_bits`: Number of weight bits
-- `n_a_bits`: Number of activation and input bits
-- `n_accum_bits`: Maximal allowed bit-width of intermediate accumulators
-- `n_hidden_neurons_multiplier`: The number of neurons on the hidden will be the number of dimensions of the input multiplied by `n_hidden_neurons_multiplier`. Note that pruning is used to adjust the accumulator size to attempt to keep the maximum accumulator bit-width to `n_accum_bits`, meaning that not all hidden layer neurons will be active. The default value for `n_hidden_neurons_multiplier` is chosen for small dimensions of the input. Reducing this value decreases the FHE inference time considerably but also decreases the robustness and accuracy of model training.
-- `n_prune_neurons_percentage`: How many neurons to prune on the hidden layers. This should be used mostly through the dedicated `.prune()` mechanism. This can be used in when setting `n_hidden_neurons_multiplier` high (3-4), once good accuracy is obtained, to speed up the model in FHE.
-- `activation_function`: a torch class that is used to construct activation functions in the network (eg torch.ReLU, torch.SELU, torch.Sigmoid, etc)
-- `quant_narrow `: whether this network should use narrow range quantized integer values
-- `quant_signed `: whether to use signed quantized integer values
+- `input_dim` (int): Number of dimensions of the input data.
+- `n_layers` (int): Number of linear layers for this network.
+- `n_outputs` (int): Number of output classes or regression targets.
+- `n_w_bits` (int): Number of weight bits.
+- `n_a_bits` (int): Number of activation and input bits.
+- `n_accum_bits` (int): Maximal allowed bit-width of intermediate accumulators.
+- `n_hidden_neurons_multiplier` (int): The number of neurons on the hidden will be the number of dimensions of the input multiplied by `n_hidden_neurons_multiplier`. Note that pruning is used to adjust the accumulator size to attempt to keep the maximum accumulator bit-width to `n_accum_bits`, meaning that not all hidden layer neurons will be active. The default value for `n_hidden_neurons_multiplier` is chosen for small dimensions of the input. Reducing this value decreases the FHE inference time considerably but also decreases the robustness and accuracy of model training.
+- `n_prune_neurons_percentage` (float): The percentage of neurons to prune in the hidden layers. This can be used when setting `n_hidden_neurons_multiplier` with a high number (3-4), once good accuracy is obtained, in order to speed up the model in FHE.
+- `activation_function` (Type): The activation function to use in the network (e.g., torch.ReLU, torch.SELU, torch.Sigmoid, ...).
+- `quant_narrow` (bool): Whether this network should quantize the values using narrow range (e.g a 2-bits signed quantization uses \[-1, 0, 1\] instead of \[-2, -1, 0, 1\]).
+- `quant_signed` (bool): Whether this network should quantize the values using signed integers.
**Raises:**
-- `ValueError`: if the parameters have invalid values or the computed accumulator bit-width is zero
+- `ValueError`: If the parameters have invalid values or the computed accumulator bit-width is zero.
______________________________________________________________________
-
+
### method `enable_pruning`
@@ -74,11 +74,11 @@ Enable pruning in the network. Pruning must be made permanent to recover pruned
**Raises:**
-- `ValueError`: if the quantization parameters are invalid
+- `ValueError`: If the quantization parameters are invalid.
______________________________________________________________________
-
+
### method `forward`
@@ -98,7 +98,7 @@ Forward pass.
______________________________________________________________________
-
+
### method `make_pruning_permanent`
@@ -110,7 +110,7 @@ Make the learned pruning permanent in the network.
______________________________________________________________________
-
+
### method `max_active_neurons`
@@ -124,4 +124,4 @@ The computation is done using the quantization parameters passed to the construc
**Returns:**
-- `n` (int): maximum number of active neurons
+- `int`: The maximum number of active neurons.
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.rf.md b/docs/developer-guide/api/concrete.ml.sklearn.rf.md
index e91163803..abe213464 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.rf.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.rf.md
@@ -6,20 +6,15 @@
Implement RandomForest models.
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `RandomForestClassifier`
Implements the RandomForest classifier.
-
+
### method `__init__`
@@ -97,7 +92,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -107,7 +102,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -117,7 +112,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
### method `post_processing`
@@ -127,13 +122,13 @@ post_processing(y_preds: ndarray) → ndarray
______________________________________________________________________
-
+
## class `RandomForestRegressor`
Implements the RandomForest regressor.
-
+
### method `__init__`
@@ -210,7 +205,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -220,7 +215,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.svm.md b/docs/developer-guide/api/concrete.ml.sklearn.svm.md
index bc858c589..43a1eb861 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.svm.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.svm.md
@@ -6,14 +6,9 @@
Implement Support Vector Machine.
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `LinearSVR`
@@ -27,7 +22,7 @@ A Regression Support Vector Machine (SVM).
For more details on LinearSVR please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVR.html
-
+
### method `__init__`
@@ -93,7 +88,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -103,7 +98,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -113,7 +108,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `LinearSVC`
@@ -127,7 +122,7 @@ A Classification Support Vector Machine (SVM).
For more details on LinearSVC please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html
-
+
### method `__init__`
@@ -195,7 +190,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -205,7 +200,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.tree.md b/docs/developer-guide/api/concrete.ml.sklearn.tree.md
index 33db4a6af..e2e912582 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.tree.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.tree.md
@@ -6,20 +6,15 @@
Implement DecisionTree models.
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `DecisionTreeClassifier`
Implements the sklearn DecisionTreeClassifier.
-
+
### method `__init__`
@@ -91,7 +86,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -101,7 +96,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -111,7 +106,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
### method `post_processing`
@@ -121,13 +116,13 @@ post_processing(y_preds: ndarray) → ndarray
______________________________________________________________________
-
+
## class `DecisionTreeRegressor`
Implements the sklearn DecisionTreeClassifier.
-
+
### method `__init__`
@@ -198,7 +193,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -208,7 +203,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
diff --git a/docs/developer-guide/api/concrete.ml.sklearn.xgb.md b/docs/developer-guide/api/concrete.ml.sklearn.xgb.md
index d91ea9da2..f7f39c33b 100644
--- a/docs/developer-guide/api/concrete.ml.sklearn.xgb.md
+++ b/docs/developer-guide/api/concrete.ml.sklearn.xgb.md
@@ -6,14 +6,9 @@
Implements XGBoost models.
-## **Global Variables**
-
-- **TRUSTED_SKOPS**
-- **USE_SKOPS**
-
______________________________________________________________________
-
+
## class `XGBClassifier`
@@ -21,7 +16,7 @@ Implements the XGBoost classifier.
See https://xgboost.readthedocs.io/en/stable/python/python_api.html#module-xgboost.sklearn for more information about the parameters used.
-
+
### method `__init__`
@@ -107,7 +102,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -117,7 +112,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### classmethod `load_dict`
@@ -127,7 +122,7 @@ load_dict(metadata: Dict)
______________________________________________________________________
-
+
## class `XGBRegressor`
@@ -135,7 +130,7 @@ Implements the XGBoost regressor.
See https://xgboost.readthedocs.io/en/stable/python/python_api.html#module-xgboost.sklearn for more information about the parameters used.
-
+
### method `__init__`
@@ -221,7 +216,7 @@ Is None if the model is not fitted.
______________________________________________________________________
-
+
### method `dump_dict`
@@ -231,7 +226,7 @@ dump_dict() → Dict[str, Any]
______________________________________________________________________
-
+
### method `fit`
@@ -241,7 +236,7 @@ fit(X, y, *args, **kwargs) → Any
______________________________________________________________________
-
+
### classmethod `load_dict`
diff --git a/docs/developer-guide/api/concrete.ml.torch.compile.md b/docs/developer-guide/api/concrete.ml.torch.compile.md
index fb6667b1f..0dc9fcf0f 100644
--- a/docs/developer-guide/api/concrete.ml.torch.compile.md
+++ b/docs/developer-guide/api/concrete.ml.torch.compile.md
@@ -13,7 +13,7 @@ torch compilation function.
______________________________________________________________________
-
+
## function `convert_torch_tensor_or_numpy_array_to_numpy_array`
@@ -35,7 +35,39 @@ Convert a torch tensor or a numpy array to a numpy array.
______________________________________________________________________
-
+
+
+## function `build_quantized_module`
+
+```python
+build_quantized_module(
+ model: Union[Module, ModelProto],
+ torch_inputset: Union[Tensor, ndarray, Tuple[Union[Tensor, ndarray], ]],
+ import_qat: bool = False,
+ n_bits=8,
+ rounding_threshold_bits: Optional[int] = None
+) → QuantizedModule
+```
+
+Build a quantized module from a Torch or ONNX model.
+
+Take a model in torch or ONNX, turn it to numpy, quantize its inputs / weights / outputs and retrieve the associated quantized module.
+
+**Args:**
+
+- `model` (Union\[torch.nn.Module, onnx.ModelProto\]): The model to quantize, either in torch or in ONNX.
+- `torch_inputset` (Dataset): the calibration input-set, can contain either torch tensors or numpy.ndarray
+- `import_qat` (bool): Flag to signal that the network being imported contains quantizers in in its computation graph and that Concrete ML should not re-quantize it
+- `n_bits`: the number of bits for the quantization
+- `rounding_threshold_bits` (int): if not None, every accumulators in the model are rounded down to the given bits of precision
+
+**Returns:**
+
+- `QuantizedModule`: The resulting QuantizedModule.
+
+______________________________________________________________________
+
+
## function `compile_torch_model`
@@ -66,7 +98,7 @@ Take a model in torch, turn it to numpy, quantize its inputs / weights / outputs
- `import_qat` (bool): Set to True to import a network that contains quantizers and was trained using quantization aware training
- `configuration` (Configuration): Configuration object to use during compilation
- `artifacts` (DebugArtifacts): Artifacts object to fill during compilation
-- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, eg, for debugging or demo
+- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, e.g., for debugging or demo
- `n_bits`: the number of bits for the quantization
- `rounding_threshold_bits` (int): if not None, every accumulators in the model are rounded down to the given bits of precision
- `p_error` (Optional\[float\]): probability of error of a single PBS
@@ -79,7 +111,7 @@ Take a model in torch, turn it to numpy, quantize its inputs / weights / outputs
______________________________________________________________________
-
+
## function `compile_onnx_model`
@@ -110,7 +142,7 @@ Take a model in torch, turn it to numpy, quantize its inputs / weights / outputs
- `import_qat` (bool): Flag to signal that the network being imported contains quantizers in in its computation graph and that Concrete ML should not re-quantize it.
- `configuration` (Configuration): Configuration object to use during compilation
- `artifacts` (DebugArtifacts): Artifacts object to fill during compilation
-- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, eg, for debugging or demo
+- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, e.g., for debugging or demo
- `n_bits`: the number of bits for the quantization
- `rounding_threshold_bits` (int): if not None, every accumulators in the model are rounded down to the given bits of precision
- `p_error` (Optional\[float\]): probability of error of a single PBS
@@ -123,7 +155,7 @@ Take a model in torch, turn it to numpy, quantize its inputs / weights / outputs
______________________________________________________________________
-
+
## function `compile_brevitas_qat_model`
@@ -154,7 +186,7 @@ The torch_model parameter is a subclass of torch.nn.Module that uses quantized o
- `n_bits` (Optional\[Union\[int, dict\]): the number of bits for the quantization. By default, for most models, a value of None should be given, which instructs Concrete ML to use the bit-widths configured using Brevitas quantization options. For some networks, that perform a non-linear operation on an input on an output, if None is given, a default value of 8 bits is used for the input/output quantization. For such models the user can also specify a dictionary with model_inputs/model_outputs keys to override the 8-bit default or a single integer for both values.
- `configuration` (Configuration): Configuration object to use during compilation
- `artifacts` (DebugArtifacts): Artifacts object to fill during compilation
-- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, eg, for debugging or demo
+- `show_mlir` (bool): if set, the MLIR produced by the converter and which is going to be sent to the compiler backend is shown on the screen, e.g., for debugging or demo
- `rounding_threshold_bits` (int): if not None, every accumulators in the model are rounded down to the given bits of precision
- `p_error` (Optional\[float\]): probability of error of a single PBS
- `global_p_error` (Optional\[float\]): probability of error of the full circuit. In FHE simulation `global_p_error` is set to 0