mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-20 19:12:24 +00:00
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:
parent
9acaf534a6
commit
2e13d5f0ab
1 changed files with 11 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue