Resize - 10 vs 11#

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 → Resize11 +9 -74
Resize10 → Resize11 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
2
  Each dimension value of the output tensor is:
3
- output_dimension = floor(input_dimension * (roi_end - roi_start) * scale) if input "sizes" is not specified.
3
+ output_dimension = floor(input_dimension * scale).
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.
43
5
  * **mode**:
44
- Three interpolation modes: nearest (default), linear and cubic. The
6
+ Two interpolation modes: nearest (default), and linear (including
7
+ bilinear, trilinear, etc)
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).
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".
56
8
  **Inputs**
57
- Between 3 and 4 inputs.
58
-
59
- * **X** (heterogeneous) - **T1**:
9
+ * **X** (heterogeneous) - **T**:
60
10
  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"
66
11
  * **scales** (heterogeneous) - **tensor(float)**:
67
12
  The scale array along each dimension. It takes value greater than 0.
68
13
  If it's less than 1, it's sampling down, otherwise, it's upsampling.
69
14
  The number of elements of 'scales' should be the same as the rank of
15
+ input 'X'.
70
- input 'X'. If 'size' is needed, the user must set 'scales' to an
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.
76
16
  **Outputs**
77
- * **Y** (heterogeneous) - **T1**:
17
+ * **Y** (heterogeneous) - **T**:
78
18
  N-D tensor after resizing
79
19
  **Type Constraints**
80
- * **T1** in (
20
+ * **T** in (
81
21
  tensor(bool),
82
22
  tensor(complex128),
83
23
  tensor(complex64),
84
24
  tensor(double),
85
25
  tensor(float),
86
26
  tensor(float16),
87
27
  tensor(int16),
88
28
  tensor(int32),
89
29
  tensor(int64),
90
30
  tensor(int8),
91
31
  tensor(string),
92
32
  tensor(uint16),
93
33
  tensor(uint32),
94
34
  tensor(uint64),
95
35
  tensor(uint8)
96
36
  ):
97
- Constrain input 'X' and output 'Y' to all tensor types.
37
+ Constrain input 'X' and output 'Y' to all tensor types.- * **T2** in (
98
- tensor(double),
99
- tensor(float),
100
- tensor(float16)
101
- ):
102
- Constrain roi type to float or double.