Add decorator for dynamic type check of functions parameters in Python.
Add decorator for dynamic type check of functions parameters in Python. Allowing better error messages for end users.
Usage example:
@aidge_core.utils.check_types
def export_onnx(graph_view: aidge_core.GraphView,
path_to_save: str,
inputs_dims: Dict[str, List[List[int]]] = None,
outputs_dims: Dict[str, List[List[int]]] = None,
verbose: bool = False,
enable_custom_op: bool = False,
opset: int = None):
# My code ...
aidge_onnx.export_onnx(
model,
"myonnx.onnx",
inputs_dims={"Input": [1, 12, 24, 24]},
outputs_dims={"reshape_op_2": [[1, 12, 24, 24]]}
)
Will result in:
TypeError: In export_onnx: "inputs_dims" parameter must be of type dict[str, list[list[int]]] but is of type dict[str, list[int]] instead.