Concrete ML
WebsiteLibrariesProducts & ServicesDevelopersSupport
1.1
1.1
  • What is Concrete ML?
  • Getting Started
    • Installation
    • Key Concepts
    • Inference in the Cloud
    • Demos and Tutorials
  • 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
    • Optimizing Inference
  • Advanced topics
    • Quantization
    • Pruning
    • Compilation
    • Prediction with FHE
    • Production Deployment
    • Advanced Features
    • Serialization
  • 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.check_inputs.md
      • concrete.ml.common.debugging.custom_assert.md
      • concrete.ml.common.debugging.md
      • concrete.ml.common.md
      • concrete.ml.common.serialization.decoder.md
      • concrete.ml.common.serialization.dumpers.md
      • concrete.ml.common.serialization.encoder.md
      • concrete.ml.common.serialization.loaders.md
      • concrete.ml.common.serialization.md
      • concrete.ml.common.utils.md
      • concrete.ml.deployment.deploy_to_aws.md
      • concrete.ml.deployment.deploy_to_docker.md
      • concrete.ml.deployment.fhe_client_server.md
      • concrete.ml.deployment.md
      • concrete.ml.deployment.server.md
      • concrete.ml.deployment.utils.md
      • concrete.ml.onnx.convert.md
      • concrete.ml.onnx.md
      • concrete.ml.onnx.onnx_impl_utils.md
      • concrete.ml.onnx.onnx_model_manipulations.md
      • concrete.ml.onnx.onnx_utils.md
      • concrete.ml.onnx.ops_impl.md
      • concrete.ml.pytest.md
      • concrete.ml.pytest.torch_models.md
      • concrete.ml.pytest.utils.md
      • concrete.ml.quantization.base_quantized_op.md
      • concrete.ml.quantization.md
      • concrete.ml.quantization.post_training.md
      • concrete.ml.quantization.quantized_module.md
      • concrete.ml.quantization.quantized_ops.md
      • concrete.ml.quantization.quantizers.md
      • concrete.ml.search_parameters.md
      • concrete.ml.search_parameters.p_error_search.md
      • concrete.ml.sklearn.base.md
      • concrete.ml.sklearn.glm.md
      • concrete.ml.sklearn.linear_model.md
      • concrete.ml.sklearn.md
      • concrete.ml.sklearn.qnn.md
      • concrete.ml.sklearn.qnn_module.md
      • concrete.ml.sklearn.rf.md
      • concrete.ml.sklearn.svm.md
      • concrete.ml.sklearn.tree.md
      • concrete.ml.sklearn.tree_to_numpy.md
      • concrete.ml.sklearn.xgb.md
      • concrete.ml.torch.compile.md
      • concrete.ml.torch.md
      • concrete.ml.torch.numpy_module.md
      • concrete.ml.version.md
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
  • module concrete.ml.onnx.onnx_utils
  • Global Variables
  • function get_attribute
  • function get_op_type
  • function execute_onnx_with_numpy
  • function remove_initializer_from_input

Was this helpful?

Export as PDF
  1. Developer Guide
  2. API

concrete.ml.onnx.onnx_utils.md

Previousconcrete.ml.onnx.onnx_model_manipulations.mdNextconcrete.ml.onnx.ops_impl.md

Last updated 1 year ago

Was this helpful?

module concrete.ml.onnx.onnx_utils

Utils to interpret an ONNX model with numpy.

Global Variables

  • ATTR_TYPES

  • ATTR_GETTERS

  • ONNX_OPS_TO_NUMPY_IMPL

  • ONNX_COMPARISON_OPS_TO_NUMPY_IMPL_FLOAT

  • ONNX_COMPARISON_OPS_TO_NUMPY_IMPL_BOOL

  • ONNX_OPS_TO_NUMPY_IMPL_BOOL

  • IMPLEMENTED_ONNX_OPS


function get_attribute

get_attribute(attribute: AttributeProto) → Any

Get the attribute from an ONNX AttributeProto.

Args:

  • attribute (onnx.AttributeProto): The attribute to retrieve the value from.

Returns:

  • Any: The stored attribute value.


function get_op_type

get_op_type(node)

Construct the qualified type name of the ONNX operator.

Args:

  • node (Any): ONNX graph node

Returns:

  • result (str): qualified name


function execute_onnx_with_numpy

execute_onnx_with_numpy(graph: GraphProto, *inputs: ndarray) → Tuple[ndarray, ]

Execute the provided ONNX graph on the given inputs.

Args:

  • graph (onnx.GraphProto): The ONNX graph to execute.

  • *inputs: The inputs of the graph.

Returns:

  • Tuple[numpy.ndarray]: The result of the graph's execution.


function remove_initializer_from_input

remove_initializer_from_input(model: ModelProto)

Remove initializers from model inputs.

In some cases, ONNX initializers may appear, erroneously, as graph inputs. This function searches all model inputs and removes those that are initializers.

Args:

  • model (onnx.ModelProto): the model to clean

Returns:

  • onnx.ModelProto: the cleaned model