Resize - 10 vs 18#

Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.

Files changed (1) hide show
  1. Resize10 → Resize18 +11 -115
Resize10 → Resize18 RENAMED
@@ -1 +1 @@
1
- Resize the input tensor. In general, it calculates every value in the output tensor as a weighted average of neighborhood (a.k.a. sampling locations) in the input tensor.
1
+ Resize the input tensor.
2
- Each dimension value of the output tensor is: <br/>
2
+ Each dimension value of the output tensor is:
3
- output_dimension = floor(input_dimension * (roi_end - roi_start) * scale) <br/>
3
+ output_dimension = floor(input_dimension * scale).
4
- if input "sizes" is not specified.
5
4
  **Attributes**
6
- * **antialias**:
7
- If set to 1, "linear" and "cubic" interpolation modes will use an
8
- antialiasing filter when downscaling. Antialiasing is achieved by
9
- stretching the resampling filter by a factor max(1, 1 / scale),
10
- which means that when downsampling, more input pixels contribute to
11
- an output pixel.
12
- * **axes**:
13
- If provided, it specifies a subset of axes that 'roi', 'scales' and
14
- 'sizes' refer to. If not provided, all axes are assumed [0, 1, ...,
15
- r-1], where r = rank(data). Non-specified dimensions are interpreted
16
- as non-resizable. Negative value means counting dimensions from the
17
- back. Accepted range is [-r, r-1], where r = rank(data). Behavior is
18
- undefined if an axis is repeated.
19
- * **coordinate_transformation_mode**:
20
- This attribute describes how to transform the coordinate in the
21
- resized tensor to the coordinate in the original tensor. <br/> The
22
- coordinate of each dimension is transformed individually. Let's
23
- describe a case using axis x as an example. Denote x_resized as the
24
- coordinate of axis x in the resized tensor, x_original as the
25
- coordinate of axis x in the original tensor, length_original as
26
- the length of the original tensor in axis x, length_resized as the
27
- length of the resized tensor in axis x, roi_x = (start_x, end_x) of
28
- the axis x in input "roi", scale = length_resized /
29
- length_original, <br/> if coordinate_transformation_mode is
30
- "half_pixel", <br/> x_original = (x_resized + 0.5) / scale - 0.5
31
- <br/> if coordinate_transformation_mode is "pytorch_half_pixel",
32
- <br/> x_original = length_resized > 1 ? (x_resized + 0.5) / scale -
33
- 0.5 : 0 <br/> if coordinate_transformation_mode is
34
- "align_corners", <br/> x_original = x_resized * (length_original
35
- - 1) / (length_resized - 1) <br/> if
36
- coordinate_transformation_mode is "asymmetric", <br/> x_original
37
- = x_resized / scale <br/> if coordinate_transformation_mode is
38
- "tf_crop_and_resize", <br/> x_original = length_resized > 1 ?
39
- start_x * (length_original - 1) + x_resized * (end_x - start_x) *
40
- (length_original - 1) / (length_resized - 1) : 0.5 * (start_x +
41
- end_x) * (length_original - 1) .
42
- * **cubic_coeff_a**:
43
- The coefficient 'a' used in cubic interpolation. Two common choice
44
- are -0.5 (in some cases of TensorFlow) and -0.75 (in PyTorch). Check
45
- out Equation (4) in https://ieeexplore.ieee.org/document/1163711 for
46
- the details. This attribute is valid only if mode is "cubic".
47
- * **exclude_outside**:
48
- If set to 1, the weight of sampling locations outside the tensor
49
- will be set to 0 and the weight will be renormalized so that their
50
- sum is 1.0. The default value is 0.
51
- * **extrapolation_value**:
52
- When coordinate_transformation_mode is "tf_crop_and_resize" and
53
- x_original is outside the range [0, length_original - 1], this value
54
- is used as the corresponding output value. Default is 0.0f.
55
- * **keep_aspect_ratio_policy**:
56
- This attribute describes how to interpret the sizes input with
57
- regard to keeping the original aspect ratio of the input, and it is
58
- not applicable when the scales input is used. <br/> Given a set
59
- of sizes, associated with a subset of axes (explicitly provided
60
- or default), and assuming d = axes[i], with i being the index of
61
- the provided sizes. <br/> If keep_aspect_ratio_policy is
62
- "stretch", the original aspect ratio is disregarded, and the input
63
- is resized to the specified size: <br/> out_size[d] = sizes[i]
64
- <br/> If keep_aspect_ratio_policy is "not_larger", the sizes
65
- are adjusted so that no extent of the output is larger than the
66
- specified size, while keeping the original aspect ratio: <br/>
67
- scale = Min(sizes[i] / in_size[d]) <br/> out_size[d] =
68
- round_int(scale * in_size[i]) <br/> If keep_aspect_ratio_policy
69
- is "not_smaller", the sizes are adjusted so that no extent of the
70
- output is smaller than the specified size, while keeping the
71
- original aspect ratio: <br/> scale = Max(sizes[i] / in_size[d])
72
- <br/> out_size[d] = round_int(scale * in_size[i]) <br/> For non-
73
- resizable axes (those not specified in axes), the output size will
74
- be equal to the input size. Note: round_int stands for computing
75
- the nearest integer value, rounding halfway cases up.
76
5
  * **mode**:
77
- Three interpolation modes: "nearest" (default), "linear" and
6
+ Two interpolation modes: nearest (default), and linear (including
7
+ bilinear, trilinear, etc)
78
- "cubic". The "linear" mode includes linear interpolation for 1D
79
- tensor and N-linear interpolation for N-D tensor (for example,
80
- bilinear interpolation for 2D tensor). The "cubic" mode includes
81
- cubic interpolation for 1D tensor and N-cubic interpolation for N-D
82
- tensor (for example, bicubic interpolation for 2D tensor).
83
- * **nearest_mode**:
84
- Four modes: "round_prefer_floor" (default, as known as round half
85
- down), "round_prefer_ceil" (as known as round half up), "floor",
86
- "ceil". Only used by nearest interpolation. It indicates how to get
87
- "nearest" pixel in input tensor from x_original, so this attribute
88
- is valid only if "mode" is "nearest".
89
8
  **Inputs**
90
- Between 1 and 4 inputs.
91
-
92
- * **X** (heterogeneous) - **T1**:
9
+ * **X** (heterogeneous) - **T**:
93
10
  N-D tensor
94
- * **roi** (optional, heterogeneous) - **T2**:
95
- 1-D tensor given as [start1, ..., startN, end1, ..., endN], where N
96
- is the rank of X or the length of axes, if provided. The RoIs'
97
- coordinates are normalized in the coordinate system of the input
98
- image. It only takes effect when coordinate_transformation_mode is
99
- "tf_crop_and_resize"
100
- * **scales** (optional, heterogeneous) - **tensor(float)**:
11
+ * **scales** (heterogeneous) - **tensor(float)**:
101
12
  The scale array along each dimension. It takes value greater than 0.
102
13
  If it's less than 1, it's sampling down, otherwise, it's upsampling.
103
14
  The number of elements of 'scales' should be the same as the rank of
15
+ input 'X'.
104
- input 'X' or the length of 'axes', if provided. One of 'scales' and
105
- 'sizes' MUST be specified and it is an error if both are specified.
106
- If 'sizes' is needed, the user can use an empty string as the name
107
- of 'scales' in this operator's input list.
108
- * **sizes** (optional, heterogeneous) - **tensor(int64)**:
109
- Target size of the output tensor. Its interpretation depends on the
110
- 'keep_aspect_ratio_policy' value.The number of elements of 'sizes'
111
- should be the same as the rank of input 'X', or the length of
112
- 'axes', if provided. Only one of 'scales' and 'sizes' can be
113
- specified.
114
16
  **Outputs**
115
- * **Y** (heterogeneous) - **T1**:
17
+ * **Y** (heterogeneous) - **T**:
116
18
  N-D tensor after resizing
117
19
  **Type Constraints**
118
- * **T1** in (
20
+ * **T** in (
119
- tensor(bfloat16),
120
21
  tensor(bool),
121
22
  tensor(complex128),
122
23
  tensor(complex64),
123
24
  tensor(double),
124
25
  tensor(float),
125
26
  tensor(float16),
126
27
  tensor(int16),
127
28
  tensor(int32),
128
29
  tensor(int64),
129
30
  tensor(int8),
130
31
  tensor(string),
131
32
  tensor(uint16),
132
33
  tensor(uint32),
133
34
  tensor(uint64),
134
35
  tensor(uint8)
135
36
  ):
136
- Constrain input 'X' and output 'Y' to all tensor types.
37
+ Constrain input 'X' and output 'Y' to all tensor types.- * **T2** in (
137
- tensor(double),
138
- tensor(float),
139
- tensor(float16)
140
- ):
141
- Constrain roi type to float or double.