Resize - 10 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.

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