@@ -6844,56 +6844,58 @@ def image_resize(input,
6844
6844
6845
6845
Example:
6846
6846
6847
- For scale:
6848
-
6849
- if align_corners = True && out_size > 1 :
6847
+ .. code-block:: text
6850
6848
6851
- scale_factor = (in_size-1.0)/(out_size-1.0)
6852
-
6853
- else:
6849
+ For scale:
6854
6850
6855
- scale_factor = float(in_size/out_size)
6856
-
6857
-
6858
- Nearest neighbor interpolation:
6859
-
6860
- if:
6861
- align_corners = False
6851
+ if align_corners = True && out_size > 1 :
6862
6852
6863
- input : (N,C,H_in,W_in)
6864
- output: (N,C,H_out,W_out) where:
6853
+ scale_factor = (in_size-1.0)/(out_size-1.0)
6854
+
6855
+ else:
6856
+
6857
+ scale_factor = float(in_size/out_size)
6858
+
6859
+
6860
+ Nearest neighbor interpolation:
6861
+
6862
+ if:
6863
+ align_corners = False
6865
6864
6866
- H_out = \left \lfloor {H_{in} * scale_{}factor}} \r ight \r floor
6867
- W_out = \left \lfloor {W_{in} * scale_{}factor}} \r ight \r floor
6865
+ input : (N,C,H_in,W_in)
6866
+ output: (N,C,H_out,W_out) where:
6868
6867
6869
- else:
6870
- align_corners = True
6868
+ H_out = floor (H_{in} * scale_{factor})
6869
+ W_out = floor (W_{in} * scale_{factor})
6871
6870
6872
- input : (N,C,H_in,W_in)
6873
- output: (N,C,H_out,W_out) where:
6871
+ else:
6872
+ align_corners = True
6874
6873
6875
- H_out = round(H_{in} * scale_{factor} )
6876
- W_out = round(W_{in} * scale_{factor})
6874
+ input : (N,C,H_in,W_in )
6875
+ output: (N,C,H_out,W_out) where:
6877
6876
6878
- Bilinear interpolation:
6877
+ H_out = round(H_{in} * scale_{factor})
6878
+ W_out = round(W_{in} * scale_{factor})
6879
6879
6880
- if:
6881
- align_corners = False , align_mode = 0
6882
-
6883
- input : (N,C,H_in,W_in)
6884
- output: (N,C,H_out,W_out) where:
6885
-
6886
- H_out = (H_{in}+0.5) * scale_{factor} - 0.5
6887
- W_out = (W_{in}+0.5) * scale_{factor} - 0.5
6880
+ Bilinear interpolation:
6881
+
6882
+ if:
6883
+ align_corners = False , align_mode = 0
6884
+
6885
+ input : (N,C,H_in,W_in)
6886
+ output: (N,C,H_out,W_out) where:
6887
+
6888
+ H_out = (H_{in}+0.5) * scale_{factor} - 0.5
6889
+ W_out = (W_{in}+0.5) * scale_{factor} - 0.5
6888
6890
6889
6891
6890
- else:
6891
-
6892
- input : (N,C,H_in,W_in)
6893
- output: (N,C,H_out,W_out) where:
6892
+ else:
6893
+
6894
+ input : (N,C,H_in,W_in)
6895
+ output: (N,C,H_out,W_out) where:
6894
6896
6895
- H_out = H_{in} * scale_{factor}
6896
- W_out = W_{in} * scale_{factor}
6897
+ H_out = H_{in} * scale_{factor}
6898
+ W_out = W_{in} * scale_{factor}
6897
6899
6898
6900
For details of nearest neighbor interpolation, please refer to Wikipedia:
6899
6901
https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation.
@@ -7048,41 +7050,39 @@ def resize_bilinear(input,
7048
7050
Align_corners and align_mode are optinal parameters,the calculation
7049
7051
method of interpolation can be selected by them.
7050
7052
7051
-
7052
- Align_corners and align_mode are optinal parameters,the calculation method
7053
- of interpolation can be selected by them.
7054
-
7055
7053
Example:
7056
7054
7057
- For scale:
7058
-
7059
- if align_corners = True && out_size > 1 :
7055
+ .. code-block:: text
7060
7056
7061
- scale_factor = (in_size-1.0)/(out_size-1.0)
7062
-
7063
- else:
7057
+ For scale:
7064
7058
7065
- scale_factor = float(in_size/out_size)
7059
+ if align_corners = True && out_size > 1 :
7066
7060
7067
- Bilinear interpolation:
7061
+ scale_factor = (in_size-1.0)/(out_size-1.0)
7062
+
7063
+ else:
7064
+
7065
+ scale_factor = float(in_size/out_size)
7068
7066
7069
- if:
7070
- align_corners = False , align_mode = 0
7071
-
7072
- input : (N,C,H_in,W_in)
7073
- output: (N,C,H_out,W_out) where:
7074
-
7075
- H_out = (H_{in}+0.5) * scale_{factor} - 0.5
7076
- W_out = (W_{in}+0.5) * scale_{factor} - 0.5
7067
+ Bilinear interpolation:
7068
+
7069
+ if:
7070
+ align_corners = False , align_mode = 0
7071
+
7072
+ input : (N,C,H_in,W_in)
7073
+ output: (N,C,H_out,W_out) where:
7074
+
7075
+ H_out = (H_{in}+0.5) * scale_{factor} - 0.5
7076
+ W_out = (W_{in}+0.5) * scale_{factor} - 0.5
7077
7077
7078
7078
7079
- else:
7079
+ else:
7080
7080
7081
- input : (N,C,H_in,W_in)
7082
- output: (N,C,H_out,W_out) where:
7081
+ input : (N,C,H_in,W_in)
7082
+ output: (N,C,H_out,W_out) where:
7083
7083
7084
- H_out = H_{in} * scale_{factor}
7085
- W_out = W_{in} * scale_{factor}
7084
+ H_out = H_{in} * scale_{factor}
7085
+ W_out = W_{in} * scale_{factor}
7086
7086
7087
7087
7088
7088
@@ -7134,42 +7134,44 @@ def resize_nearest(input,
7134
7134
align_corners = True ):
7135
7135
"""
7136
7136
Resize input by performing nearest neighbor interpolation in both the
7137
- 3rd dimention (in height direction) and the 4th dimention (in width
7138
- direction) based on given output shape which specified by actual_shape,
7137
+ 3rd dimension (in height direction) and the 4th dimension (in width
7138
+ direction) based on given output shape which is specified by actual_shape,
7139
7139
out_shape and scale in priority order.
7140
7140
7141
7141
Example:
7142
7142
7143
- For scale:
7144
-
7145
- if align_corners = True && out_size > 1 :
7143
+ .. code-block:: text
7144
+
7145
+ For scale:
7146
+
7147
+ if align_corners = True && out_size > 1 :
7146
7148
7147
- scale_factor = (in_size-1.0)/(out_size-1.0)
7148
-
7149
- else:
7149
+ scale_factor = (in_size-1.0)/(out_size-1.0)
7150
+
7151
+ else:
7152
+
7153
+ scale_factor = float(in_size/out_size)
7154
+
7155
+
7156
+ Nearest neighbor interpolation:
7150
7157
7151
- scale_factor = float(in_size/out_size)
7152
-
7153
-
7154
- Nearest neighbor interpolation:
7155
-
7156
- if:
7157
- align_corners = False
7158
+ if:
7159
+ align_corners = False
7158
7160
7159
- input : (N,C,H_in,W_in)
7160
- output: (N,C,H_out,W_out) where:
7161
+ input : (N,C,H_in,W_in)
7162
+ output: (N,C,H_out,W_out) where:
7161
7163
7162
- H_out = \left \lfloor { H_{in} * scale_{} factor}} \r ight \r floor
7163
- W_out = \left \lfloor { W_{in} * scale_{} factor}} \r ight \r floor
7164
+ H_out = floor( H_{in} * scale_{factor})
7165
+ W_out = floor( W_{in} * scale_{factor})
7164
7166
7165
- else:
7166
- align_corners = True
7167
+ else:
7168
+ align_corners = True
7167
7169
7168
- input : (N,C,H_in,W_in)
7169
- output: (N,C,H_out,W_out) where:
7170
+ input : (N,C,H_in,W_in)
7171
+ output: (N,C,H_out,W_out) where:
7170
7172
7171
- H_out = round(H_{in} * scale_{factor})
7172
- W_out = round(W_{in} * scale_{factor})
7173
+ H_out = round(H_{in} * scale_{factor})
7174
+ W_out = round(W_{in} * scale_{factor})
7173
7175
7174
7176
7175
7177
For details of nearest neighbor interpolation, please refer to Wikipedia:
0 commit comments