tvm
image.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
24 #ifndef TVM_RELAX_ATTRS_IMAGE_H_
25 #define TVM_RELAX_ATTRS_IMAGE_H_
26 
27 #include <tvm/relax/expr.h>
28 
29 namespace tvm {
30 namespace relax {
31 
33 struct Resize2DAttrs : public tvm::AttrsNode<Resize2DAttrs> {
39  double cubic_alpha;
43 
44  TVM_DECLARE_ATTRS(Resize2DAttrs, "relax.attrs.Resize2DAttrs") {
45  TVM_ATTR_FIELD(roi).describe(
46  "Region of Interest for coordinate transformation mode 'tf_crop_and_resize'");
47  TVM_ATTR_FIELD(layout).describe(
48  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
49  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
50  "dimensions respectively. Resize is applied on the 'H' and"
51  "'W' dimensions.");
52  TVM_ATTR_FIELD(method).describe(
53  "Specify the mode to use for scaling."
54  "nearest_neighbor - Nearest Neighbor"
55  "linear - Bilinear Interpolation"
56  "cubic - Bicubic Interpolation");
58  .describe(
59  "Describes how to transform the coordinate in the resized tensor"
60  "to the coordinate in the original tensor."
61  "Refer to the ONNX Resize operator specification for details"
62  "Available options are half_pixel, align_corners and asymmetric");
64  .describe(
65  "indicates how to find the \"nearest\" pixel in nearest_neighbor method"
66  "Available options are round, floor, and ceil.");
67  TVM_ATTR_FIELD(cubic_alpha).describe("Spline Coefficient for Bicubic Interpolation");
69  .describe("Flag to exclude exterior of the image during bicubic interpolation");
71  .describe("Value to return when roi is outside of the image");
72  TVM_ATTR_FIELD(out_dtype).describe(
73  "The dtype of the output tensor. It it is not specified, the output will have the same "
74  "dtype as input if not specified.");
75  }
76 }; // struct Resize2dAttrs
77 
78 } // namespace relax
79 } // namespace tvm
80 
81 #endif // TVM_RELAX_ATTRS_IMAGE_H_
The base class of the all the Use "curiously recurring template pattern".
Definition: attrs.h:870
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Runtime primitive data type.
Definition: data_type.h:43
Reference to string objects.
Definition: string.h:98
#define TVM_ATTR_FIELD(FieldName)
Declare an attribute field.
Definition: attrs.h:76
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Attributes used in image resize2d operator.
Definition: image.h:33
String layout
Definition: image.h:35
DataType out_dtype
Definition: image.h:42
double extrapolation_value
Definition: image.h:41
Array< FloatImm > roi
Definition: image.h:34
String method
Definition: image.h:36
String coordinate_transformation_mode
Definition: image.h:37
String rounding_method
Definition: image.h:38
TVM_DECLARE_ATTRS(Resize2DAttrs, "relax.attrs.Resize2DAttrs")
Definition: image.h:44
int cubic_exclude
Definition: image.h:40
double cubic_alpha
Definition: image.h:39