Skip to content
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

Add Split-20 - change uneven split behavior to be more torch-like #5321

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/Changelog.md
Expand Up @@ -24452,6 +24452,57 @@
<dd>Outputs are bools and are True where there is a full regex match and False otherwise.</dd>
</dl>

### <a name="Split-20"></a>**Split-20**</a>

Split a tensor into a list of tensors, along the specified 'axis'.
Either input 'split' or the attribute 'num_outputs' should be specified, but not both.
If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts.
If the input 'split' is specified, it indicates the sizes of each output in the split.
If the tensor is not evenly splittable into `num_outputs`, the behavior depends on `minimize_diff` attribute.
If `minimize_diff` is set to 'true' (default), the difference
between the number of elements in the output tensors is minimized, which
results in the last few dimensions' sizes being lowered by one.
If 'minimize_diff' is set to 'false', the last output tensors will be emptied in order to
accomodate for the missing values.

Check warning on line 24466 in docs/Changelog.md

View workflow job for this annotation

GitHub Actions / Optional Lint

[misspell] reported by reviewdog 🐶 "accomodate" is a misspelling of "accommodate" Raw Output: ./docs/Changelog.md:24466:2: "accomodate" is a misspelling of "accommodate"

#### Version

This version of the operator has been available since version 20 of the default ONNX operator set.

#### Attributes

<dl>
<dt><tt>axis</tt> : int (default is 0)</dt>
<dd>Which axis to split on. A negative value means counting dimensions from the back. Accepted range is [-rank, rank-1] where r = rank(input).</dd>
<dt><tt>minimize_diff</tt> : int (required)</dt>
<dd>Uneven split mode.</dd>
<dt><tt>num_outputs</tt> : int</dt>
<dd>Number of outputs to split parts of the tensor into.</dd>
</dl>

#### Inputs (1 - 2)

<dl>
<dt><tt>input</tt> (differentiable) : T</dt>
<dd>The tensor to split</dd>
<dt><tt>split</tt> (optional, non-differentiable) : tensor(int64)</dt>
<dd>Optional length of each output. Values should be >= 0.Sum of the values must be equal to the dim value at 'axis' specified.</dd>
</dl>

#### Outputs (1 - &#8734;)

<dl>
<dt><tt>outputs</tt> (variadic, differentiable) : T</dt>
<dd>One or more outputs forming list of tensors after splitting</dd>
</dl>

#### Type Constraints

<dl>
<dt><tt>T</tt> : tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bfloat16), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128)</dt>
<dd>Constrain input and output types to all tensor types.</dd>
</dl>

### <a name="StringConcat-20"></a>**StringConcat-20**</a>

StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support)
Expand Down