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