File IO
Input Bounds
Keras Reader
- omlt.io.keras_reader.load_keras_sequential(nn, scaling_object=None, scaled_input_bounds=None)[source]
Load a keras neural network model (built with Sequential) into an OMLT network definition object. This network definition object can be used in different formulations.
- Parameters
nn (keras.model) – A keras model that was built with Sequential
scaling_object (instance of ScalingInterface or None) – Provide an instance of a scaling object to use to scale iputs –> scaled_inputs and scaled_outputs –> outputs. If None, no scaling is performed. See scaling.py.
scaled_input_bounds (dict or None) – A dict that contains the bounds on the scaled variables (the direct inputs to the neural network). If None, then no bounds are specified.
- Return type
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
- 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