fix split shape inference error for opset >= 13 (#19756)

### Description
get split operator split section by opset

### Motivation and Context
for opset higher than 13, split section is treated as an input.
This commit is contained in:
inisis 2024-03-05 01:41:36 +08:00 committed by GitHub
parent 9acaf534a6
commit 2e13d5f0ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1940,8 +1940,17 @@ class SymbolicShapeInference:
def _infer_Split_Common(self, node, make_value_info_func): # noqa: N802
input_sympy_shape = self._get_sympy_shape(node, 0)
axis = handle_negative_axis(get_attribute(node, "axis", 0), len(input_sympy_shape))
split = get_attribute(node, "split")
if not split:
op_set = get_opset(self.out_mp_)
# Depending on op-version 'split' are provided as attribute or via 2nd input
if op_set < 13:
split = get_attribute(node, "split")
assert self._try_get_value(node, 1) is None
else:
split = self._try_get_value(node, 1)
assert get_attribute(node, "split") is None
if split is None:
num_outputs = len(node.output)
split = [input_sympy_shape[axis] / sympy.Integer(num_outputs)] * num_outputs
self._update_computed_dims(split)