|
|
|
@ -6844,56 +6844,58 @@ def image_resize(input,
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
For scale:
|
|
|
|
|
.. code-block:: text
|
|
|
|
|
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
For scale:
|
|
|
|
|
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nearest neighbor interpolation:
|
|
|
|
|
Nearest neighbor interpolation:
|
|
|
|
|
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = \left \lfloor {H_{in} * scale_{}factor}} \right \rfloor
|
|
|
|
|
W_out = \left \lfloor {W_{in} * scale_{}factor}} \right \rfloor
|
|
|
|
|
H_out = floor (H_{in} * scale_{factor})
|
|
|
|
|
W_out = floor (W_{in} * scale_{factor})
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
align_corners = True
|
|
|
|
|
else:
|
|
|
|
|
align_corners = True
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = round(H_{in} * scale_{factor})
|
|
|
|
|
W_out = round(W_{in} * scale_{factor})
|
|
|
|
|
H_out = round(H_{in} * scale_{factor})
|
|
|
|
|
W_out = round(W_{in} * scale_{factor})
|
|
|
|
|
|
|
|
|
|
Bilinear interpolation:
|
|
|
|
|
Bilinear interpolation:
|
|
|
|
|
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False , align_mode = 0
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False , align_mode = 0
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = (H_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
W_out = (W_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
H_out = (H_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
W_out = (W_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = H_{in} * scale_{factor}
|
|
|
|
|
W_out = W_{in} * scale_{factor}
|
|
|
|
|
H_out = H_{in} * scale_{factor}
|
|
|
|
|
W_out = W_{in} * scale_{factor}
|
|
|
|
|
|
|
|
|
|
For details of nearest neighbor interpolation, please refer to Wikipedia:
|
|
|
|
|
https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation.
|
|
|
|
@ -7048,41 +7050,39 @@ def resize_bilinear(input,
|
|
|
|
|
Align_corners and align_mode are optinal parameters,the calculation
|
|
|
|
|
method of interpolation can be selected by them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Align_corners and align_mode are optinal parameters,the calculation method
|
|
|
|
|
of interpolation can be selected by them.
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
For scale:
|
|
|
|
|
.. code-block:: text
|
|
|
|
|
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
For scale:
|
|
|
|
|
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
|
|
|
|
|
Bilinear interpolation:
|
|
|
|
|
Bilinear interpolation:
|
|
|
|
|
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False , align_mode = 0
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False , align_mode = 0
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = (H_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
W_out = (W_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
H_out = (H_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
W_out = (W_{in}+0.5) * scale_{factor} - 0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = H_{in} * scale_{factor}
|
|
|
|
|
W_out = W_{in} * scale_{factor}
|
|
|
|
|
H_out = H_{in} * scale_{factor}
|
|
|
|
|
W_out = W_{in} * scale_{factor}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -7134,42 +7134,44 @@ def resize_nearest(input,
|
|
|
|
|
align_corners=True):
|
|
|
|
|
"""
|
|
|
|
|
Resize input by performing nearest neighbor interpolation in both the
|
|
|
|
|
3rd dimention(in height direction) and the 4th dimention(in width
|
|
|
|
|
direction) based on given output shape which specified by actual_shape,
|
|
|
|
|
3rd dimension(in height direction) and the 4th dimension(in width
|
|
|
|
|
direction) based on given output shape which is specified by actual_shape,
|
|
|
|
|
out_shape and scale in priority order.
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
For scale:
|
|
|
|
|
.. code-block:: text
|
|
|
|
|
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
For scale:
|
|
|
|
|
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
if align_corners = True && out_size > 1 :
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
scale_factor = (in_size-1.0)/(out_size-1.0)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
scale_factor = float(in_size/out_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nearest neighbor interpolation:
|
|
|
|
|
Nearest neighbor interpolation:
|
|
|
|
|
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False
|
|
|
|
|
if:
|
|
|
|
|
align_corners = False
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = \left \lfloor {H_{in} * scale_{}factor}} \right \rfloor
|
|
|
|
|
W_out = \left \lfloor {W_{in} * scale_{}factor}} \right \rfloor
|
|
|
|
|
H_out = floor(H_{in} * scale_{factor})
|
|
|
|
|
W_out = floor(W_{in} * scale_{factor})
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
align_corners = True
|
|
|
|
|
else:
|
|
|
|
|
align_corners = True
|
|
|
|
|
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
input : (N,C,H_in,W_in)
|
|
|
|
|
output: (N,C,H_out,W_out) where:
|
|
|
|
|
|
|
|
|
|
H_out = round(H_{in} * scale_{factor})
|
|
|
|
|
W_out = round(W_{in} * scale_{factor})
|
|
|
|
|
H_out = round(H_{in} * scale_{factor})
|
|
|
|
|
W_out = round(W_{in} * scale_{factor})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For details of nearest neighbor interpolation, please refer to Wikipedia:
|
|
|
|
|