DLR: Compact Runtime for Machine Learning Models
Get the current value of an input.
name (str) – The name of an input
shape (np.array (optional)) – If given, use as the shape of the returned array. Otherwise, the shape of the returned array will be inferred from the last call to set_input().
Get the type of the input at the given index.
Get the name of the input at the given index.
Get the type of the output at the given index.
Get the name of the output at the given index. Only valid when the model has a metadata file.
Get all output names. Only valid when the model has a metadata file.
names
list of str
Get version of loaded DLR library.
version
str “{major}.{minor}.{patch}”
Whether the model has a metadata file which provides additional information such as output names.
has_metadata
Run inference with given input(s)
input_values (a single numpy.ndarray
or a dictionary) –
For decision tree models, provide a single numpy.ndarray
to indicate a single input, as decision trees always accept only one
input.
For deep learning models, provide a dictionary where keys are input
names (of type str
) and values are input tensors (of type
numpy.ndarray
). Deep learning models allow more than one
input, so each input must have a unique name.
out – Prediction result