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 support for GridSampleV22 #274

Draft
wants to merge 2 commits into
base: feature/onnx-to-tosa
Choose a base branch
from
Draft
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
53 changes: 52 additions & 1 deletion docs/Dialects/onnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3531,6 +3531,57 @@ Effects: `MemoryEffects::Effect{}`

_ONNX GridSample operation_

Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`.
For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2),
the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W),
the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out).
More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr),
the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out).

The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in).
The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values
at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode)
and a padding mode (for `grid` positions falling outside the 2-dimensional image).

For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`.
They are used to interpolate output values of `Y[n, c, h_out, w_out]`.

The GridSample operator is often used in doing grid generator and sampler in the
[Spatial Transformer Networks](https://arxiv.org/abs/1506.02025).
See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html).

Traits: `AlwaysSpeculatableImplTrait`, `OpVersionTrait<22>`

Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)`, `ShapeHelperOpInterface`, `ShapeInferenceOpInterface`

Effects: `MemoryEffects::Effect{}`

#### Attributes:

<table>
<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr>
<tr><td><code>align_corners</code></td><td>::mlir::IntegerAttr</td><td>64-bit signed integer attribute</td></tr>
<tr><td><code>mode</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr>
<tr><td><code>padding_mode</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr>
</table>

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `X` | tensor of 8-bit unsigned integer values or tensor of 16-bit unsigned integer values or tensor of 32-bit unsigned integer values or tensor of 64-bit unsigned integer values or tensor of 8-bit signless integer values or tensor of 16-bit signless integer values or tensor of 32-bit signless integer values or tensor of 64-bit signless integer values or tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values or tensor of string type values or tensor of 1-bit signless integer values or tensor of complex type with 32-bit float elements values or tensor of complex type with 64-bit float elements values
| `grid` | tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values

#### Results:

| Result | Description |
| :----: | ----------- |
| `Y` | tensor of 8-bit unsigned integer values or tensor of 16-bit unsigned integer values or tensor of 32-bit unsigned integer values or tensor of 64-bit unsigned integer values or tensor of 8-bit signless integer values or tensor of 16-bit signless integer values or tensor of 32-bit signless integer values or tensor of 64-bit signless integer values or tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values or tensor of string type values or tensor of 1-bit signless integer values or tensor of complex type with 32-bit float elements values or tensor of complex type with 64-bit float elements values

### `onnx.GridSampleV16` (ONNXGridSampleV16Op)

_ONNX GridSample operation_

Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from `grid`.
Currently, only spatial (4-D) inputs are supported. For input `X` with shape (N, C, H, W) and `grid` with shape (N, H_out, W_out, 2),
the output `Y` will have shape (N, C, H_out, W_out).
Expand All @@ -3545,7 +3596,7 @@ They are used to interpolate output values of `Y[N, C, H_out, W_out]`.
The GridSample operator is often used in doing grid generator and sampler in the [Spatial Transformer Networks](https://arxiv.org/abs/1506.02025).
See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/master/generated/torch.nn.functional.grid_sample.html#torch-nn-functional-grid-sample).

Traits: `AlwaysSpeculatableImplTrait`
Traits: `AlwaysSpeculatableImplTrait`, `OpVersionTrait<16>`

Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)`, `ShapeHelperOpInterface`, `ShapeInferenceOpInterface`

Expand Down
4 changes: 3 additions & 1 deletion src/Builder/OpBuildTable.inc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ op_dialect_version_map_["GlobalMaxPool"] = {1};
op_dialect_version_map_["Gradient"] = {1};
op_dialect_version_map_["Greater"] = {13};
op_dialect_version_map_["GreaterOrEqual"] = {16};
op_dialect_version_map_["GridSample"] = {16};
op_dialect_version_map_["GridSample"] = {22, 16};
op_dialect_version_map_["GroupNormalization"] = {21, 18};
op_dialect_version_map_["HammingWindow"] = {17};
op_dialect_version_map_["HannWindow"] = {17};
Expand Down Expand Up @@ -358,6 +358,8 @@ import_handler_map_["GreaterOrEqual"] =
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGreaterOrEqualOp>;
import_handler_map_["GridSample"] =
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGridSampleOp>;
import_handler_map_["GridSampleV16"] =
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGridSampleV16Op>;
import_handler_map_["GroupNormalization"] =
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGroupNormalizationOp>;
import_handler_map_["GroupNormalizationV18"] =
Expand Down
54 changes: 52 additions & 2 deletions src/Dialect/ONNX/ONNXOps.td.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3117,6 +3117,57 @@ def ONNXGreaterOrEqualOp:ONNX_Op<"GreaterOrEqual",
}

def ONNXGridSampleOp:ONNX_Op<"GridSample",
[Pure, OpVersionTrait<22>, DeclareOpInterfaceMethods<ShapeInferenceOpInterface>, DeclareOpInterfaceMethods<ShapeHelperOpInterface>]> {
let summary = "ONNX GridSample operation";
let description = [{
Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`.
For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2),
the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W),
the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out).
More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr),
the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out).

The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in).
The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values
at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode)
and a padding mode (for `grid` positions falling outside the 2-dimensional image).

For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`.
They are used to interpolate output values of `Y[n, c, h_out, w_out]`.

The GridSample operator is often used in doing grid generator and sampler in the
[Spatial Transformer Networks](https://arxiv.org/abs/1506.02025).
See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html).
}];
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>]>]>:$X,
AnyTypeOf<[TensorOf<[BF16]>, TensorOf<[F16]>, TensorOf<[F32]>, TensorOf<[F64]>]>:$grid,
DefaultValuedAttr<SI64Attr, "0">:$align_corners,
DefaultValuedStrAttr<StrAttr, "linear">:$mode,
DefaultValuedStrAttr<StrAttr, "zeros">:$padding_mode);
let results = (outs 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>]>]>:$Y);
let extraClassDeclaration = [{
static int getNumberOfOperands() {
return 2;
}
static int getNumberOfResults() {
return 1;
}
static std::vector<int> getTypeMap() {
return {30};
}
}];
let extraClassDefinition = [{
onnx_mlir::ONNXOpShapeHelper * $cppClass::getShapeHelper(mlir::Operation *op, llvm::ArrayRef<mlir::Value> oper,
onnx_mlir::IndexExprBuilder *ieb, onnx_mlir::IndexExprScope *scope) {
onnx_mlir::ONNXOpShapeHelper *sh = new onnx_mlir::ONNXGridSampleOpShapeHelper(op, oper, ieb, scope);
assert(sh && "failed to allocate shape helper");
return sh;
}
}];
let hasVerifier = 1;
}

def ONNXGridSampleV16Op:ONNX_Op<"GridSampleV16",
[Pure, OpVersionTrait<16>, DeclareOpInterfaceMethods<ShapeInferenceOpInterface>, DeclareOpInterfaceMethods<ShapeHelperOpInterface>]> {
let summary = "ONNX GridSample operation";
let description = [{
Expand Down Expand Up @@ -3154,12 +3205,11 @@ def ONNXGridSampleOp:ONNX_Op<"GridSample",
let extraClassDefinition = [{
onnx_mlir::ONNXOpShapeHelper * $cppClass::getShapeHelper(mlir::Operation *op, llvm::ArrayRef<mlir::Value> oper,
onnx_mlir::IndexExprBuilder *ieb, onnx_mlir::IndexExprScope *scope) {
onnx_mlir::ONNXOpShapeHelper *sh = new onnx_mlir::ONNXGridSampleOpShapeHelper(op, oper, ieb, scope);
onnx_mlir::ONNXOpShapeHelper *sh = new onnx_mlir::ONNXGridSampleV16OpShapeHelper(op, oper, ieb, scope);
assert(sh && "failed to allocate shape helper");
return sh;
}
}];
let hasVerifier = 1;
}

def ONNXGroupNormalizationOp:ONNX_Op<"GroupNormalization",
Expand Down
15 changes: 15 additions & 0 deletions src/Dialect/ONNX/ONNXOps/Tensor/GridSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ LogicalResult ONNXGridSampleOpShapeHelper::computeShape() {

LogicalResult ONNXGridSampleOp::verify() {
ONNXGridSampleOpAdaptor operandAdaptor(*this);
auto op = mlir::cast<ONNXGridSampleOp>(*this);

const auto alignCorners = op.getAlignCorners();
if (alignCorners != 0 && alignCorners != 1) {
return emitOpError("align_corners needs to be 0 or 1");
}
const auto mode = op.getMode();
if (mode != "linear" && mode != "nearest" && mode != "cubic") {
return emitOpError("mode needs to be linear, nearest or cubic");
}
const auto paddingMode = op.getPaddingMode();
if (paddingMode != "zeros" && paddingMode != "border" &&
paddingMode != "reflection") {
return emitOpError("padding_mode needs to be zeros, border or reflection");
}

if (!hasShapeAndRank(getOperation()))
return success();
Expand Down
1 change: 1 addition & 0 deletions src/Dialect/ONNX/ONNXUnsupportedOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ CONVERTED_TO_SUPPORTED_OPS(ONNXClipV11Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXClipV12Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXClipV6Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXDFTV17Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXGridSampleV16Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXGroupNormalizationOp)
CONVERTED_TO_SUPPORTED_OPS(ONNXGroupNormalizationV18Op)
CONVERTED_TO_SUPPORTED_OPS(ONNXPadV18Op)
Expand Down
12 changes: 12 additions & 0 deletions src/Dialect/ONNX/Transforms/Decompose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,18 @@ bool canSequenceAtBeReplaced(Value sequenceAtResult) {
return true;
}

Attribute upgradeGridSampleV16Mode(PatternRewriter &rewriter, Attribute mode) {
const auto stringMode = mlir::cast<StringAttr>(mode);
if (stringMode.strref() == "bilinear") {
return rewriter.getStringAttr("linear");
}
if (stringMode.strref() == "bicubic") {
return rewriter.getStringAttr("cubic");
}
assert(stringMode.strref() == "nearest");
return mode;
}

Value replaceSequenceAt(
PatternRewriter &rewriter, Location loc, Value sequenceAtResult) {
ONNXSequenceAtOp op = sequenceAtResult.getDefiningOp<ONNXSequenceAtOp>();
Expand Down
9 changes: 9 additions & 0 deletions src/Dialect/ONNX/Transforms/Decompose.td
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def ReshapeElementsAttrToRank0 : NativeCodeCall<

def ReplaceSequenceAt : NativeCodeCall<
"onnx_mlir::replaceSequenceAt($_builder, $_loc, $0)">;

def UpgradeGridSampleV16Mode : NativeCodeCall<
"onnx_mlir::upgradeGridSampleV16Mode($_builder, $0)">;

def CanSequenceAtBeReplaced :
Constraint<CPred<"::onnx_mlir::canSequenceAtBeReplaced($_self)">, "check whether the SequenceAt can be replaced with split">;
Expand Down Expand Up @@ -365,6 +368,12 @@ def ClipV12Pattern : Pat<
(ONNXClipOp $x, $min, $max)
>;

// Rewrite GridSample 16 to GridSample 22
def GridSampleV16Pattern : Pat<
(ONNXGridSampleV16Op $x, $grid, $align_corners, $mode, $padding_mode),
(ONNXGridSampleOp $x, $grid, $align_corners, (UpgradeGridSampleV16Mode $mode), $padding_mode)
>;

def DFTV17Pattern : Pat<
(ONNXDFTV17Op $x, $dft_length, $axis, $inverse, $onesided),
(ONNXDFTOp $x, $dft_length, (ONNXConstantOpFromDenseAttr(createScalarDenseAttrRank0 $axis)), $inverse, $onesided)
Expand Down
30 changes: 27 additions & 3 deletions test/mlir/onnx/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -820,22 +820,46 @@ func.func @test_mod_diff_element_type(%arg0: tensor<16x32xf32>, %arg1: tensor<16

func.func @test_grid_sample_diff_ranks(%arg0: tensor<1x3x1152x1344xf32>, %arg1: tensor<1x1152x2xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op Input(=4) and grid(=3) have different dim sizes.}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "bilinear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x3x1152x1344xf32>, tensor<1x1152x2xf32>) -> tensor<*xf32>
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "linear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x3x1152x1344xf32>, tensor<1x1152x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}

// -----

func.func @test_grid_sample_diff_batch(%arg0: tensor<1x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op Input and grid must have the same batch value.}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "bilinear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "linear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}

// -----

func.func @test_grid_sample_align_corners(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op align_corners needs to be 0 or 1}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 2 : si64, mode = "linear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}

// -----

func.func @test_grid_sample_mode(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op mode needs to be linear, nearest or cubic}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "sampling", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}

// -----

func.func @test_grid_sample_padding(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op padding_mode needs to be zeros, border or reflection}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "cubic", onnx_node_name = "GridSample_181", padding_mode = "bottom"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}

// -----

func.func @test_grid_sample_wrong_dim_grid(%arg0: tensor<1x1x4x4xf32>, %arg1: tensor<1x6x6x3xf32>) -> tensor<*xf32> {
// expected-error @+1 {{'onnx.GridSample' op Grid last dim must have been '2' instead of '3'.}}
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "bilinear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x1x4x4xf32>, tensor<1x6x6x3xf32>) -> tensor<*xf32>
%0 = "onnx.GridSample"(%arg0, %arg1) {align_corners = 1 : si64, mode = "linear", onnx_node_name = "GridSample_181", padding_mode = "border"} : (tensor<1x1x4x4xf32>, tensor<1x6x6x3xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
}
36 changes: 36 additions & 0 deletions test/mlir/onnx/onnx_decompose.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

// -----

func.func @test_grid_sample_v16_bicubic(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
%0 = "onnx.GridSampleV16"(%arg0, %arg1) {align_corners = 1 : si64, mode = "bicubic", onnx_node_name = "GridSample_181", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
// CHECK-LABEL: func.func @test_grid_sample_v16_bicubic
// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<2x1x4x4xf32>, [[PARAM_1_:%.+]]: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// CHECK: [[VAR_0_:%.+]] = "onnx.GridSample"([[PARAM_0_]], [[PARAM_1_]]) {align_corners = 1 : si64, mode = "cubic", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
// CHECK: return [[VAR_0_]] : tensor<*xf32>
// CHECK: }
}

// -----

func.func @test_grid_sample_v16_bilinear(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
%0 = "onnx.GridSampleV16"(%arg0, %arg1) {align_corners = 1 : si64, mode = "bilinear", onnx_node_name = "GridSample_181", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
// CHECK-LABEL: func.func @test_grid_sample_v16_bilinear
// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<2x1x4x4xf32>, [[PARAM_1_:%.+]]: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// CHECK: [[VAR_0_:%.+]] = "onnx.GridSample"([[PARAM_0_]], [[PARAM_1_]]) {align_corners = 1 : si64, mode = "linear", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
// CHECK: return [[VAR_0_]] : tensor<*xf32>
// CHECK: }
}

// -----

func.func @test_grid_sample_v16_nearest(%arg0: tensor<2x1x4x4xf32>, %arg1: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
%0 = "onnx.GridSampleV16"(%arg0, %arg1) {align_corners = 1 : si64, mode = "nearest", onnx_node_name = "GridSample_181", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
return %0 : tensor<*xf32>
// CHECK-LABEL: func.func @test_grid_sample_v16_nearest
// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<2x1x4x4xf32>, [[PARAM_1_:%.+]]: tensor<2x6x6x2xf32>) -> tensor<*xf32> {
// CHECK: [[VAR_0_:%.+]] = "onnx.GridSample"([[PARAM_0_]], [[PARAM_1_]]) {align_corners = 1 : si64, mode = "nearest", padding_mode = "zeros"} : (tensor<2x1x4x4xf32>, tensor<2x6x6x2xf32>) -> tensor<*xf32>
// CHECK: return [[VAR_0_]] : tensor<*xf32>
// CHECK: }
}

// -----

func.func @test_dft(%arg0 : tensor<?x?x?xf32>, %arg1 : tensor<?xi64>) -> tensor<*xf32> {
%cst = "onnx.NoValue"() {value} : () -> none
%0 ="onnx.DFTV17"(%arg0, %arg1) : (tensor<?x?x?xf32>, tensor<?xi64>)-> tensor<*xf32>
Expand Down
Loading