From d2f45bb601e841e1339a7e33a8b463eac70519de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?xavier=20dupr=C3=A9?= Date: Mon, 26 Jul 2021 12:04:14 +0200 Subject: [PATCH] Avoids raising an exception when an optional parameter is not specified --- mlprodict/onnxrt/ops_cpu/_op.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlprodict/onnxrt/ops_cpu/_op.py b/mlprodict/onnxrt/ops_cpu/_op.py index dde17b0f5..6512baa4e 100644 --- a/mlprodict/onnxrt/ops_cpu/_op.py +++ b/mlprodict/onnxrt/ops_cpu/_op.py @@ -116,7 +116,7 @@ def __init__(self, onnx_node, desc=None, expected_attributes=None, if onnx_node.op_type not in _at_least_one: for k, v in self._schema.attributes.items(): - if not hasattr(self, k): + if not hasattr(self, k) and getattr(v, 'required', True): raise RuntimeError( # pragma: no cover "Attribute '{}' is expected based on ONNX specifications " "for node '{}' and options {}.".format(