File IO

Input Bounds

omlt.io.input_bounds.load_input_bounds(input_bounds_filename)[source]

Read the input bounds from the given file.

omlt.io.input_bounds.write_input_bounds(input_bounds_filename, input_bounds)[source]

Write the specified input bounds to the given file.

Keras Reader

ONNX

omlt.io.onnx.load_onnx_neural_network(onnx, scaling_object=None, input_bounds=None)[source]

Load a NetworkDefinition from an onnx object.

Parameters:
  • onnx – onnx model

  • scaling_object (instance of object supporting ScalingInterface) –

  • input_bounds (list of tuples) –

Return type:

NetworkDefinition

omlt.io.onnx.load_onnx_neural_network_with_bounds(filename)[source]

Load a NetworkDefinition with input bounds from an onnx object.

Parameters:

filename (str) – the path where the ONNX model and input bounds file are written

Return type:

NetworkDefinition

omlt.io.onnx.write_onnx_model_with_bounds(filename, onnx_model=None, input_bounds=None)[source]

Write the ONNX model to the given file.

If input_bounds is not None, write it alongside the ONNX model.

Parameters:
  • filename (str) – the path where the ONNX model is written

  • onnx_model (onnx model or None) – the onnx model

  • input_bounds (None or dict-like or list) – bounds on the input variables

class omlt.io.onnx_parser.NetworkParser[source]

Bases: object

References

parse_network(graph, scaling_object, input_bounds)[source]