-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operator spec of Split operator's attribute num_outputs is wrong #5766
Comments
The Split-18 PR: #4481 @p-wysocki What's the intention of cc @onnx/sig-operators-approvers |
Good catch! The onnx spec need to be updated to require the input being evenly splittable by num_outputs, if num_outputs is specified. This is the same as tf: "that value.shape[axis] is divisible by num_or_size_splits". In the case where num_or_size_splits in TF and split_size_or_sections in pytorch NOT being a single integer, it is covered by "split" input in ONNX. To support split_size_or_sections being a single integer in Pytorch, we need add an attribute "split_size" where the last output may be smaller than split_size. Here is how cases in TF and Pytroch are covered in ONNX: |
@liqunfu Thank you for the update! That sounds good. Do we plan to include this in next release? |
Yes. It however needs to consolidate with #4742 the PR: #5321. @p-wysocki , any update of the PR and shall/does it cover this issue? |
Copy #4742 (comment) One step further, we can fix the current attribute
|
The Problem
In op version 18, we added the spec of Split attribute
num_outputs
with the statementConsider the case
Split(input, 4)
whereinput
has dim[5]
, what the shape of the outputs will be?According to the shape inference code, the shape of the output tensors should be
[2], [2], [2], [-1]
which is illegal.Reference
It seems to me that we were trying to combine the definition of numpy/TF and Torch.
For Numpy/TF, they use the similar semantic, but REJECT if not divisible:
Torch instead declares it as a split size, in which way indivisible is acceptable:
Possible Solutions
num_outputs
and reject if indivisible.The text was updated successfully, but these errors were encountered: