diff --git a/onnx2kerastl/reshape_layers.py b/onnx2kerastl/reshape_layers.py index 744b17dd..f67cc940 100644 --- a/onnx2kerastl/reshape_layers.py +++ b/onnx2kerastl/reshape_layers.py @@ -451,8 +451,11 @@ def convert_slice(node, params, layers, lambda_func, node_name, keras_name): steps = list(params.get("steps", [None] * len(axes))) # when the 'ends' value is the int64 maximum, probably happen because [idx:] sets large end num in conversion - if ends[0].dtype == np.int64 and not isinstance(ends[0], KerasTensor): - if ends[0] > max_ends_val: + if not isinstance(ends[0], KerasTensor): + if hasattr(ends[0], 'dtype'): + if ends[0].dtype == np.int64 and ends[0] > max_ends_val: + ends = [np.int32(max_ends_val)] + elif isinstance(ends[0], int) and ends[0] > max_ends_val: ends = [np.int32(max_ends_val)] try: max_len = len(layers[node.input[0]].shape) diff --git a/pyproject.toml b/pyproject.toml index 4f215a77..0f2273a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "onnx2kerastl" -version = "0.0.168" +version = "0.0.169" description = "" authors = ["dorhar "] license = "MIT"