Concrete ML
WebsiteLibrariesProducts & ServicesDevelopersSupport
0.5
0.5
  • What is Concrete ML?
  • Getting Started
    • Installation
    • Key Concepts
    • Inference in the Cloud
  • Built-in Models
    • Linear Models
    • Tree-based Models
    • Neural Networks
    • Pandas
    • Built-in Model Examples
  • Deep Learning
    • Using Torch
    • Using ONNX
    • Step-by-Step Guide
    • Deep Learning Examples
    • Debugging Models
  • Advanced topics
    • Quantization
    • Pruning
    • Compilation
    • Production Deployment
    • Advanced Features
  • Developer Guide
    • Workflow
      • Set Up the Project
      • Set Up Docker
      • Documentation
      • Support and Issues
      • Contributing
    • Inner workings
      • Importing ONNX
      • Quantization tools
      • FHE Op-graph design
      • External Libraries
    • API
      • concrete.ml.common
      • concrete.ml.common.check_inputs
      • concrete.ml.common.debugging
      • concrete.ml.common.debugging.custom_assert
      • concrete.ml.common.utils
      • concrete.ml.deployment
      • concrete.ml.deployment.fhe_client_server
      • concrete.ml.onnx
      • concrete.ml.onnx.convert
      • concrete.ml.onnx.onnx_model_manipulations
      • concrete.ml.onnx.onnx_utils
      • concrete.ml.onnx.ops_impl
      • concrete.ml.quantization
      • concrete.ml.quantization.base_quantized_op
      • concrete.ml.quantization.post_training
      • concrete.ml.quantization.quantized_module
      • concrete.ml.quantization.quantized_ops
      • concrete.ml.quantization.quantizers
      • concrete.ml.sklearn
      • concrete.ml.sklearn.base
      • concrete.ml.sklearn.glm
      • concrete.ml.sklearn.linear_model
      • concrete.ml.sklearn.protocols
      • concrete.ml.sklearn.qnn
      • concrete.ml.sklearn.rf
      • concrete.ml.sklearn.svm
      • concrete.ml.sklearn.torch_module
      • concrete.ml.sklearn.tree
      • concrete.ml.sklearn.tree_to_numpy
      • concrete.ml.sklearn.xgb
      • concrete.ml.torch
      • concrete.ml.torch.compile
      • concrete.ml.torch.numpy_module
      • concrete.ml.version
Powered by GitBook

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers
On this page
  • API Overview
  • Modules
  • Classes
  • Functions

Was this helpful?

Export as PDF
  1. Developer Guide

API

API Overview

Modules

  • concrete.ml.common: Module for shared data structures and code.

  • concrete.ml.common.check_inputs: Check and conversion tools.

  • concrete.ml.common.debugging: Module for debugging.

  • concrete.ml.common.debugging.custom_assert: Provide some variants of assert.

  • concrete.ml.common.utils: Utils that can be re-used by other pieces of code in the module.

  • concrete.ml.deployment: Module for deployment of the FHE model.

  • concrete.ml.deployment.fhe_client_server: APIs for FHE deployment.

  • concrete.ml.onnx: ONNX module.

  • concrete.ml.onnx.convert: ONNX conversion related code.

  • concrete.ml.onnx.onnx_impl_utils: Utility functions for onnx operator implementations.

  • concrete.ml.onnx.onnx_model_manipulations: Some code to manipulate models.

  • concrete.ml.onnx.onnx_utils: Utils to interpret an ONNX model with numpy.

  • concrete.ml.onnx.ops_impl: ONNX ops implementation in python + numpy.

  • concrete.ml.quantization: Modules for quantization.

  • concrete.ml.quantization.base_quantized_op: Base Quantized Op class that implements quantization for a float numpy op.

  • concrete.ml.quantization.post_training: Post Training Quantization methods.

  • concrete.ml.quantization.quantized_module: QuantizedModule API.

  • concrete.ml.quantization.quantized_ops: Quantized versions of the ONNX operators for post training quantization.

  • concrete.ml.quantization.quantizers: Quantization utilities for a numpy array/tensor.

  • concrete.ml.sklearn: Import sklearn models.

  • concrete.ml.sklearn.base: Module that contains base classes for our libraries estimators.

  • concrete.ml.sklearn.glm: Implement sklearn's Generalized Linear Models (GLM).

  • concrete.ml.sklearn.linear_model: Implement sklearn linear model.

  • concrete.ml.sklearn.protocols: Protocols.

  • concrete.ml.sklearn.qnn: Scikit-learn interface for concrete quantized neural networks.

  • concrete.ml.sklearn.rf: Implements RandomForest models.

  • concrete.ml.sklearn.svm: Implement Support Vector Machine.

  • concrete.ml.sklearn.torch_module: Implement torch module.

  • concrete.ml.sklearn.tree: Implement the sklearn tree models.

  • concrete.ml.sklearn.tree_to_numpy: Implements the conversion of a tree model to a numpy function.

  • concrete.ml.sklearn.xgb: Implements XGBoost models.

  • concrete.ml.torch: Modules for torch to numpy conversion.

  • concrete.ml.torch.compile: torch compilation function.

  • concrete.ml.torch.numpy_module: A torch to numpy module.

  • concrete.ml.version: File to manage the version of the package.

Classes

  • fhe_client_server.FHEModelClient: Client API to encrypt and decrypt FHE data.

  • fhe_client_server.FHEModelDev: Dev API to save the model and then load and run the FHE circuit.

  • fhe_client_server.FHEModelServer: Server API to load and run the FHE circuit.

  • ops_impl.ONNXMixedFunction: A mixed quantized-raw valued onnx function.

  • base_quantized_op.QuantizedOp: Base class for quantized ONNX ops implemented in numpy.

  • base_quantized_op.QuantizedOpUnivariateOfEncrypted: An univariate operator of an encrypted value.

  • post_training.ONNXConverter: Base ONNX to Concrete ML computation graph conversion class.

  • post_training.PostTrainingAffineQuantization: Post-training Affine Quantization.

  • post_training.PostTrainingQATImporter: Converter of Quantization Aware Training networks.

  • quantized_module.QuantizedModule: Inference for a quantized model.

  • quantized_ops.QuantizedAbs: Quantized Abs op.

  • quantized_ops.QuantizedAdd: Quantized Addition operator.

  • quantized_ops.QuantizedAvgPool: Quantized Average Pooling op.

  • quantized_ops.QuantizedBatchNormalization: Quantized Batch normalization with encrypted input and in-the-clear normalization params.

  • quantized_ops.QuantizedBrevitasQuant: Brevitas uniform quantization with encrypted input.

  • quantized_ops.QuantizedCast: Cast the input to the required data type.

  • quantized_ops.QuantizedCelu: Quantized Celu op.

  • quantized_ops.QuantizedClip: Quantized clip op.

  • quantized_ops.QuantizedConv: Quantized Conv op.

  • quantized_ops.QuantizedDiv: Div operator /.

  • quantized_ops.QuantizedElu: Quantized Elu op.

  • quantized_ops.QuantizedErf: Quantized erf op.

  • quantized_ops.QuantizedExp: Quantized Exp op.

  • quantized_ops.QuantizedFlatten: Quantized flatten for encrypted inputs.

  • quantized_ops.QuantizedFloor: Quantized Floor op.

  • quantized_ops.QuantizedGemm: Quantized Gemm op.

  • quantized_ops.QuantizedGreater: Comparison operator >.

  • quantized_ops.QuantizedGreaterOrEqual: Comparison operator >=.

  • quantized_ops.QuantizedHardSigmoid: Quantized HardSigmoid op.

  • quantized_ops.QuantizedHardSwish: Quantized Hardswish op.

  • quantized_ops.QuantizedIdentity: Quantized Identity op.

  • quantized_ops.QuantizedLeakyRelu: Quantized LeakyRelu op.

  • quantized_ops.QuantizedLess: Comparison operator <.

  • quantized_ops.QuantizedLessOrEqual: Comparison operator <=.

  • quantized_ops.QuantizedLog: Quantized Log op.

  • quantized_ops.QuantizedMatMul: Quantized MatMul op.

  • quantized_ops.QuantizedMax: Quantized Max op.

  • quantized_ops.QuantizedMin: Quantized Min op.

  • quantized_ops.QuantizedMul: Multiplication operator.

  • quantized_ops.QuantizedNeg: Quantized Neg op.

  • quantized_ops.QuantizedNot: Quantized Not op.

  • quantized_ops.QuantizedOr: Or operator ||.

  • quantized_ops.QuantizedPRelu: Quantized PRelu op.

  • quantized_ops.QuantizedPad: Quantized Padding op.

  • quantized_ops.QuantizedPow: Quantized pow op.

  • quantized_ops.QuantizedReduceSum: ReduceSum with encrypted input.

  • quantized_ops.QuantizedRelu: Quantized Relu op.

  • quantized_ops.QuantizedReshape: Quantized Reshape op.

  • quantized_ops.QuantizedRound: Quantized round op.

  • quantized_ops.QuantizedSelu: Quantized Selu op.

  • quantized_ops.QuantizedSigmoid: Quantized sigmoid op.

  • quantized_ops.QuantizedSign: Quantized Neg op.

  • quantized_ops.QuantizedSoftplus: Quantized Softplus op.

  • quantized_ops.QuantizedSub: Subtraction operator.

  • quantized_ops.QuantizedTanh: Quantized Tanh op.

  • quantized_ops.QuantizedTranspose: Transpose operator for quantized inputs.

  • quantized_ops.QuantizedWhere: Where operator on quantized arrays.

  • quantizers.MinMaxQuantizationStats: Calibration set statistics.

  • quantizers.QuantizationOptions: Options for quantization.

  • quantizers.QuantizedArray: Abstraction of quantized array.

  • quantizers.UniformQuantizationParameters: Quantization parameters for uniform quantization.

  • quantizers.UniformQuantizer: Uniform quantizer.

  • base.BaseTreeClassifierMixin: Mixin class for tree-based classifiers.

  • base.BaseTreeEstimatorMixin: Mixin class for tree-based estimators.

  • base.BaseTreeRegressorMixin: Mixin class for tree-based regressors.

  • base.QuantizedTorchEstimatorMixin: Mixin that provides quantization for a torch module and follows the Estimator API.

  • base.SklearnLinearClassifierMixin: A Mixin class for sklearn linear classifiers with FHE.

  • base.SklearnLinearModelMixin: A Mixin class for sklearn linear models with FHE.

  • glm.GammaRegressor: A Gamma regression model with FHE.

  • glm.PoissonRegressor: A Poisson regression model with FHE.

  • glm.TweedieRegressor: A Tweedie regression model with FHE.

  • linear_model.ElasticNet: An ElasticNet regression model with FHE.

  • linear_model.Lasso: A Lasso regression model with FHE.

  • linear_model.LinearRegression: A linear regression model with FHE.

  • linear_model.LogisticRegression: A logistic regression model with FHE.

  • linear_model.Ridge: A Ridge regression model with FHE.

  • protocols.ConcreteBaseClassifierProtocol: Concrete classifier protocol.

  • protocols.ConcreteBaseEstimatorProtocol: A Concrete Estimator Protocol.

  • protocols.ConcreteBaseRegressorProtocol: Concrete regressor protocol.

  • protocols.Quantizer: Quantizer Protocol.

  • qnn.FixedTypeSkorchNeuralNet: A mixin with a helpful modification to a skorch estimator that fixes the module type.

  • qnn.NeuralNetClassifier: Scikit-learn interface for quantized FHE compatible neural networks.

  • qnn.NeuralNetRegressor: Scikit-learn interface for quantized FHE compatible neural networks.

  • qnn.QuantizedSkorchEstimatorMixin: Mixin class that adds quantization features to Skorch NN estimators.

  • qnn.SparseQuantNeuralNetImpl: Sparse Quantized Neural Network classifier.

  • rf.RandomForestClassifier: Implements the RandomForest classifier.

  • rf.RandomForestRegressor: Implements the RandomForest regressor.

  • svm.LinearSVC: A Classification Support Vector Machine (SVM).

  • svm.LinearSVR: A Regression Support Vector Machine (SVM).

  • tree.DecisionTreeClassifier: Implements the sklearn DecisionTreeClassifier.

  • tree.DecisionTreeRegressor: Implements the sklearn DecisionTreeClassifier.

  • tree_to_numpy.Task: Task enumerate.

  • xgb.XGBClassifier: Implements the XGBoost classifier.

  • xgb.XGBRegressor: Implements the XGBoost regressor.

  • numpy_module.NumpyModule: General interface to transform a torch.nn.Module to numpy module.

Functions

  • check_inputs.check_X_y_and_assert: sklearn.utils.check_X_y with an assert.

  • check_inputs.check_array_and_assert: sklearn.utils.check_array with an assert.

  • custom_assert.assert_false: Provide a custom assert to check that the condition is False.

  • custom_assert.assert_not_reached: Provide a custom assert to check that a piece of code is never reached.

  • custom_assert.assert_true: Provide a custom assert to check that the condition is True.

  • utils.generate_proxy_function: Generate a proxy function for a function accepting only *args type arguments.

  • utils.get_onnx_opset_version: Return the ONNX opset_version.

  • utils.replace_invalid_arg_name_chars: Sanitize arg_name, replacing invalid chars by _.

  • convert.get_equivalent_numpy_forward: Get the numpy equivalent forward of the provided ONNX model.

  • convert.get_equivalent_numpy_forward_and_onnx_model: Get the numpy equivalent forward of the provided torch Module.

  • onnx_impl_utils.compute_conv_output_dims: Compute the output shape of a pool or conv operation.

  • onnx_impl_utils.compute_onnx_pool_padding: Compute any additional padding needed to compute pooling layers.

  • onnx_impl_utils.numpy_onnx_pad: Pad a tensor according to ONNX spec, using an optional custom pad value.

  • onnx_impl_utils.onnx_avgpool_compute_norm_const: Compute the average pooling normalization constant.

  • onnx_model_manipulations.clean_graph_after_node_name: Clean the graph of the onnx model by removing nodes after the given node name.

  • onnx_model_manipulations.clean_graph_after_node_op_type: Clean the graph of the onnx model by removing nodes after the given node type.

  • onnx_model_manipulations.keep_following_outputs_discard_others: Keep the outputs given in outputs_to_keep and remove the others from the model.

  • onnx_model_manipulations.remove_identity_nodes: Remove identity nodes from a model.

  • onnx_model_manipulations.remove_node_types: Remove unnecessary nodes from the ONNX graph.

  • onnx_model_manipulations.remove_unused_constant_nodes: Remove unused Constant nodes in the provided onnx model.

  • onnx_model_manipulations.simplify_onnx_model: Simplify an ONNX model, removes unused Constant nodes and Identity nodes.

  • onnx_utils.execute_onnx_with_numpy: Execute the provided ONNX graph on the given inputs.

  • onnx_utils.get_attribute: Get the attribute from an ONNX AttributeProto.

  • onnx_utils.get_op_name: Construct the qualified name of the ONNX operator.

  • ops_impl.cast_to_float: Cast values to floating points.

  • ops_impl.numpy_abs: Compute abs in numpy according to ONNX spec.

  • ops_impl.numpy_acos: Compute acos in numpy according to ONNX spec.

  • ops_impl.numpy_acosh: Compute acosh in numpy according to ONNX spec.

  • ops_impl.numpy_add: Compute add in numpy according to ONNX spec.

  • ops_impl.numpy_asin: Compute asin in numpy according to ONNX spec.

  • ops_impl.numpy_asinh: Compute sinh in numpy according to ONNX spec.

  • ops_impl.numpy_atan: Compute atan in numpy according to ONNX spec.

  • ops_impl.numpy_atanh: Compute atanh in numpy according to ONNX spec.

  • ops_impl.numpy_avgpool: Compute Average Pooling using Torch.

  • ops_impl.numpy_batchnorm: Compute the batch normalization of the input tensor.

  • ops_impl.numpy_cast: Execute ONNX cast in Numpy.

  • ops_impl.numpy_celu: Compute celu in numpy according to ONNX spec.

  • ops_impl.numpy_constant: Return the constant passed as a kwarg.

  • ops_impl.numpy_cos: Compute cos in numpy according to ONNX spec.

  • ops_impl.numpy_cosh: Compute cosh in numpy according to ONNX spec.

  • ops_impl.numpy_div: Compute div in numpy according to ONNX spec.

  • ops_impl.numpy_elu: Compute elu in numpy according to ONNX spec.

  • ops_impl.numpy_equal: Compute equal in numpy according to ONNX spec.

  • ops_impl.numpy_erf: Compute erf in numpy according to ONNX spec.

  • ops_impl.numpy_exp: Compute exponential in numpy according to ONNX spec.

  • ops_impl.numpy_flatten: Flatten a tensor into a 2d array.

  • ops_impl.numpy_floor: Compute Floor in numpy according to ONNX spec.

  • ops_impl.numpy_greater: Compute greater in numpy according to ONNX spec.

  • ops_impl.numpy_greater_float: Compute greater in numpy according to ONNX spec and cast outputs to floats.

  • ops_impl.numpy_greater_or_equal: Compute greater or equal in numpy according to ONNX spec.

  • ops_impl.numpy_greater_or_equal_float: Compute greater or equal in numpy according to ONNX specs and cast outputs to floats.

  • ops_impl.numpy_hardsigmoid: Compute hardsigmoid in numpy according to ONNX spec.

  • ops_impl.numpy_hardswish: Compute hardswish in numpy according to ONNX spec.

  • ops_impl.numpy_identity: Compute identity in numpy according to ONNX spec.

  • ops_impl.numpy_leakyrelu: Compute leakyrelu in numpy according to ONNX spec.

  • ops_impl.numpy_less: Compute less in numpy according to ONNX spec.

  • ops_impl.numpy_less_float: Compute less in numpy according to ONNX spec and cast outputs to floats.

  • ops_impl.numpy_less_or_equal: Compute less or equal in numpy according to ONNX spec.

  • ops_impl.numpy_less_or_equal_float: Compute less or equal in numpy according to ONNX spec and cast outputs to floats.

  • ops_impl.numpy_log: Compute log in numpy according to ONNX spec.

  • ops_impl.numpy_matmul: Compute matmul in numpy according to ONNX spec.

  • ops_impl.numpy_max: Compute Max in numpy according to ONNX spec.

  • ops_impl.numpy_min: Compute Min in numpy according to ONNX spec.

  • ops_impl.numpy_mul: Compute mul in numpy according to ONNX spec.

  • ops_impl.numpy_neg: Compute Negative in numpy according to ONNX spec.

  • ops_impl.numpy_not: Compute not in numpy according to ONNX spec.

  • ops_impl.numpy_not_float: Compute not in numpy according to ONNX spec and cast outputs to floats.

  • ops_impl.numpy_or: Compute or in numpy according to ONNX spec.

  • ops_impl.numpy_or_float: Compute or in numpy according to ONNX spec and cast outputs to floats.

  • ops_impl.numpy_pow: Compute pow in numpy according to ONNX spec.

  • ops_impl.numpy_relu: Compute relu in numpy according to ONNX spec.

  • ops_impl.numpy_round: Compute round in numpy according to ONNX spec.

  • ops_impl.numpy_selu: Compute selu in numpy according to ONNX spec.

  • ops_impl.numpy_sigmoid: Compute sigmoid in numpy according to ONNX spec.

  • ops_impl.numpy_sign: Compute Sign in numpy according to ONNX spec.

  • ops_impl.numpy_sin: Compute sin in numpy according to ONNX spec.

  • ops_impl.numpy_sinh: Compute sinh in numpy according to ONNX spec.

  • ops_impl.numpy_softmax: Compute softmax in numpy according to ONNX spec.

  • ops_impl.numpy_softplus: Compute softplus in numpy according to ONNX spec.

  • ops_impl.numpy_sub: Compute sub in numpy according to ONNX spec.

  • ops_impl.numpy_tan: Compute tan in numpy according to ONNX spec.

  • ops_impl.numpy_tanh: Compute tanh in numpy according to ONNX spec.

  • ops_impl.numpy_thresholdedrelu: Compute thresholdedrelu in numpy according to ONNX spec.

  • ops_impl.numpy_transpose: Transpose in numpy according to ONNX spec.

  • ops_impl.numpy_where: Compute the equivalent of numpy.where.

  • ops_impl.numpy_where_body: Compute the equivalent of numpy.where.

  • ops_impl.onnx_func_raw_args: Decorate a numpy onnx function to flag the raw/non quantized inputs.

  • quantizers.fill_from_kwargs: Fill a parameter set structure from kwargs parameters.

  • tree_to_numpy.tree_to_numpy: Convert the tree inference to a numpy functions using Hummingbird.

  • compile.compile_brevitas_qat_model: Compile a Brevitas Quantization Aware Training model.

  • compile.compile_onnx_model: Compile a torch module into an FHE equivalent.

  • compile.compile_torch_model: Compile a torch module into an FHE equivalent.

  • compile.convert_torch_tensor_or_numpy_array_to_numpy_array: Convert a torch tensor or a numpy array to a numpy array.

PreviousExternal LibrariesNextconcrete.ml.common

Last updated 2 years ago

Was this helpful?