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 ingestion support for pad opset 19 #2482

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Builder/OpBuildTable.inc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ op_dialect_version_map_["OptionalGetElement"] = {18};
op_dialect_version_map_["OptionalHasElement"] = {18};
op_dialect_version_map_["Or"] = {7};
op_dialect_version_map_["PRelu"] = {16};
op_dialect_version_map_["Pad"] = {18, 13, 11, 2};
op_dialect_version_map_["Pad"] = {19, 13, 11, 2};
op_dialect_version_map_["Pow"] = {15};
op_dialect_version_map_["QLinearConv"] = {10};
op_dialect_version_map_["QLinearMatMul"] = {10};
Expand Down
25 changes: 25 additions & 0 deletions src/Dialect/ONNX/ONNXOps.td.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5168,6 +5168,8 @@ def ONNXPadOp:ONNX_Op<"Pad",

3) `edge` - pads with the edge values of array

4) `wrap` - wrap-around padding as if the data tensor forms a torus


Example 1 (`constant` mode):

Expand Down Expand Up @@ -5232,6 +5234,29 @@ def ONNXPadOp:ONNX_Op<"Pad",
[4.5, 4.5, 4.5, 5.7],
]
```

Example 4 (`wrap` mode):

```
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]

pads = [2, 1, 1, 1]

mode = 'wrap'

output = [
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
]
```
}];
let arguments = (ins AnyTypeOf<[TensorOf<[UI8]>, TensorOf<[UI16]>, TensorOf<[UI32]>, TensorOf<[UI64]>, TensorOf<[I8]>, TensorOf<[I16]>, TensorOf<[I32]>, TensorOf<[I64]>, TensorOf<[BF16]>, TensorOf<[F16]>, TensorOf<[F32]>, TensorOf<[F64]>, TensorOf<[StringType]>, TensorOf<[I1]>, TensorOf<[Complex<F32>]>, TensorOf<[Complex<F64>]>]>:$data,
TensorOf<[I64]>:$pads,
Expand Down
2 changes: 1 addition & 1 deletion utils/gen_onnx_mlir.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
'OptionalHasElement' : [18],
'Or': [7],
'PRelu': [16],
'Pad': [18, 13, 11, 2],
'Pad': [19, 13, 11, 2],
'Pow': [15],
'QLinearConv': [10],
'QLinearMatMul': [10],
Expand Down
Loading