Resize - 11 vs 13#
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.
- Resize11 → Resize13 +9 -10
Resize11 → Resize13
RENAMED
@@ -1 +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.
|
2
2
|
Each dimension value of the output tensor is:
|
3
3
|
output_dimension = floor(input_dimension * (roi_end - roi_start) * scale) if input "sizes" is not specified.
|
4
4
|
**Attributes**
|
5
5
|
* **coordinate_transformation_mode**:
|
6
6
|
This attribute describes how to transform the coordinate in the
|
7
7
|
resized tensor to the coordinate in the original tensor. <br/> The
|
8
8
|
coordinate of each dimension is transformed individually. Let's
|
9
9
|
describe a case using axis x as an example. Denote x_resized as the
|
10
10
|
coordinate of axis x in the resized tensor, x_original as the
|
11
11
|
coordinate of axis x in the original tensor, length_original as the
|
12
12
|
length of the original tensor in axis x, length_resized as the
|
13
13
|
length of the resized tensor in axis x, roi_x = (start_x, end_x) of
|
14
14
|
the axis x in input "roi", scale = length_resized / length_original,
|
15
15
|
<br/> if coordinate_transformation_mode is "half_pixel", <br/>
|
16
16
|
x_original = (x_resized + 0.5) / scale - 0.5, <br/> if
|
17
17
|
coordinate_transformation_mode is "pytorch_half_pixel", <br/>
|
18
18
|
x_original = length_resized > 1 ? (x_resized + 0.5) / scale - 0.5 :
|
19
19
|
0, <br/> if coordinate_transformation_mode is "align_corners",
|
20
20
|
<br/> x_original = x_resized * (length_original - 1) /
|
21
21
|
(length_resized - 1), <br/> if coordinate_transformation_mode is
|
22
22
|
"asymmetric", <br/> x_original = x_resized / scale, <br/> if
|
23
|
+
coordinate_transformation_mode is "tf_half_pixel_for_nn", <br/>
|
24
|
+
x_original = (x_resized + 0.5) / scale, <br/> if
|
23
25
|
coordinate_transformation_mode is "tf_crop_and_resize", <br/>
|
24
26
|
x_original = length_resized > 1 ? start_x * (length_original - 1) +
|
25
27
|
x_resized * (end_x - start_x) * (length_original - 1) /
|
26
28
|
(length_resized - 1) : 0.5 * (start_x + end_x) * (length_original -
|
27
29
|
1).
|
28
30
|
* **cubic_coeff_a**:
|
29
31
|
The coefficient 'a' used in cubic interpolation. Two common choice
|
30
32
|
are -0.5 (in some cases of TensorFlow) and -0.75 (in PyTorch). Check
|
31
33
|
out Equation (4) in https://ieeexplore.ieee.org/document/1163711 for
|
32
34
|
the details. This attribute is valid only if "mode" is "cubic".
|
33
35
|
* **exclude_outside**:
|
34
36
|
If set to 1, the weight of sampling locations outside the tensor
|
35
37
|
will be set to 0 and the weight will be renormalized so that their
|
36
38
|
sum is 1.0. The default value is 0.
|
37
39
|
* **extrapolation_value**:
|
38
40
|
When coordinate_transformation_mode is "tf_crop_and_resize" and
|
39
41
|
x_original is outside the range [0, length_original - 1], this value
|
40
42
|
is used as the corresponding output value. Default is 0.0f.
|
41
43
|
* **mode**:
|
42
44
|
Three interpolation modes: nearest (default), linear and cubic. The
|
43
45
|
"linear" mode includes linear interpolation for 1D tensor and
|
44
46
|
N-linear interpolation for N-D tensor (for example, bilinear
|
45
47
|
interpolation for 2D tensor). The "cubic" mode includes cubic
|
46
48
|
interpolation for 1D tensor and N-cubic interpolation for N-D tensor
|
47
49
|
(for example, bicubic interpolation for 2D tensor).
|
48
50
|
* **nearest_mode**:
|
49
51
|
Four modes: round_prefer_floor (default, as known as round half
|
50
52
|
down), round_prefer_ceil (as known as round half up), floor, ceil.
|
51
53
|
Only used by nearest interpolation. It indicates how to get
|
52
54
|
"nearest" pixel in input tensor from x_original, so this attribute
|
53
55
|
is valid only if "mode" is "nearest".
|
54
56
|
**Inputs**
|
55
|
-
Between
|
57
|
+
Between 3 and 4 inputs.
|
56
58
|
* **X** (heterogeneous) - **T1**:
|
57
59
|
N-D tensor
|
58
|
-
* **roi** (
|
60
|
+
* **roi** (heterogeneous) - **T2**:
|
59
61
|
1-D tensor given as [start1, ..., startN, end1, ..., endN], where N
|
60
62
|
is the rank of X. The RoIs' coordinates are normalized in the
|
61
63
|
coordinate system of the input image. It only takes effect when
|
62
64
|
coordinate_transformation_mode is "tf_crop_and_resize"
|
63
|
-
* **scales** (
|
65
|
+
* **scales** (heterogeneous) - **tensor(float)**:
|
64
66
|
The scale array along each dimension. It takes value greater than 0.
|
65
67
|
If it's less than 1, it's sampling down, otherwise, it's upsampling.
|
66
68
|
The number of elements of 'scales' should be the same as the rank of
|
69
|
+
input 'X'. If 'size' is needed, the user must set 'scales' to an
|
70
|
+
empty tensor.
|
67
|
-
input 'X'. One of 'scales' and 'sizes' MUST be specified and it is
|
68
|
-
an error if both are specified. If 'sizes' is needed, the user can
|
69
|
-
use an empty string as the name of 'scales' in this operator's input
|
70
|
-
list.
|
71
71
|
* **sizes** (optional, heterogeneous) - **tensor(int64)**:
|
72
72
|
The size of the output tensor. The number of elements of 'sizes'
|
73
|
-
should be the same as the rank of input 'X'.
|
73
|
+
should be the same as the rank of input 'X'. May only be set if
|
74
|
-
|
74
|
+
'scales' is set to an empty tensor.
|
75
75
|
**Outputs**
|
76
76
|
* **Y** (heterogeneous) - **T1**:
|
77
77
|
N-D tensor after resizing
|
78
78
|
**Type Constraints**
|
79
79
|
* **T1** in (
|
80
|
-
tensor(bfloat16),
|
81
80
|
tensor(bool),
|
82
81
|
tensor(complex128),
|
83
82
|
tensor(complex64),
|
84
83
|
tensor(double),
|
85
84
|
tensor(float),
|
86
85
|
tensor(float16),
|
87
86
|
tensor(int16),
|
88
87
|
tensor(int32),
|
89
88
|
tensor(int64),
|
90
89
|
tensor(int8),
|
91
90
|
tensor(string),
|
92
91
|
tensor(uint16),
|
93
92
|
tensor(uint32),
|
94
93
|
tensor(uint64),
|
95
94
|
tensor(uint8)
|
96
95
|
):
|
97
96
|
Constrain input 'X' and output 'Y' to all tensor types.
|
98
97
|
* **T2** in (
|
99
98
|
tensor(double),
|
100
99
|
tensor(float),
|
101
100
|
tensor(float16)
|
102
101
|
):
|
103
102
|
Constrain roi type to float or double.
|