Skip to content

onnx

get_onnxruntime_execution_providers(value)

Extracts the ONNX runtime execution providers from the given string.

The input string is expected to be a comma-separated list, possibly enclosed within square brackets and containing single quotes.

Parameters:

Name Type Description Default
value str

The string containing the list of ONNX runtime execution providers.

required

Returns:

Type Description
List[str]

List[str]: A list of strings representing each execution provider.

Source code in inference/core/utils/onnx.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def get_onnxruntime_execution_providers(value: str) -> List[str]:
    """Extracts the ONNX runtime execution providers from the given string.

    The input string is expected to be a comma-separated list, possibly enclosed
    within square brackets and containing single quotes.

    Args:
        value (str): The string containing the list of ONNX runtime execution providers.

    Returns:
        List[str]: A list of strings representing each execution provider.
    """
    if len(value) == 0:
        return []
    value = value.replace("[", "").replace("]", "").replace("'", "").replace(" ", "")
    return value.split(",")