81
81
'label_smooth' ,
82
82
'roi_pool' ,
83
83
'dice_loss' ,
84
- 'upsampling_bilinear2d ' ,
84
+ 'resize_bilinear ' ,
85
85
'gather' ,
86
86
'random_crop' ,
87
87
]
@@ -3929,9 +3929,9 @@ def dice_loss(input, label, epsilon=0.00001):
3929
3929
return reduce_mean (dice_score )
3930
3930
3931
3931
3932
- def upsampling_bilinear2d (input , out_shape = None , scale = None , name = None ):
3932
+ def resize_bilinear (input , out_shape = None , scale = None , name = None ):
3933
3933
"""
3934
- The mathematical meaning of upsampling_bilinear2d is also called
3934
+ The mathematical meaning of resize bilinear layer is
3935
3935
Bilinear interpolation.
3936
3936
Bilinear interpolation is an extension of linear interpolation for
3937
3937
interpolating functions of two variables (e.g. H-direction and
@@ -3941,13 +3941,13 @@ def upsampling_bilinear2d(input, out_shape=None, scale=None, name=None):
3941
3941
https://en.wikipedia.org/wiki/Bilinear_interpolation
3942
3942
3943
3943
Args:
3944
- input (Variable): The input tensor of bilinear interpolation ,
3944
+ input (Variable): The input tensor of resize bilinear layer ,
3945
3945
This is a 4-D tensor of the shape
3946
3946
(num_batches, channels, in_h, in_w).
3947
- out_shape(list|tuple|Variable|None): Output shape of bilinear interpolation
3947
+ out_shape(list|tuple|Variable|None): Output shape of resize bilinear
3948
3948
layer, the shape is (out_h, out_w).
3949
3949
Default: None
3950
- scale(int |None): The multiplier for the input height or width.
3950
+ scale(float |None): The multiplier for the input height or width.
3951
3951
At least one of out_shape or scale must be set.
3952
3952
And out_shape has a higher priority than scale.
3953
3953
Default: None
@@ -3961,7 +3961,7 @@ def upsampling_bilinear2d(input, out_shape=None, scale=None, name=None):
3961
3961
Examples:
3962
3962
.. code-block:: python
3963
3963
3964
- out = fluid.layers.bilinear_interp (input, out_shape=[12, 12])
3964
+ out = fluid.layers.resize_bilinear (input, out_shape=[12, 12])
3965
3965
"""
3966
3966
if out_shape is None and scale is None :
3967
3967
raise ValueError ("One of out_shape and scale must not be None" )
@@ -3975,10 +3975,9 @@ def _is_list_or_turple_(data):
3975
3975
out_w = 0
3976
3976
inputs = {"X" : input }
3977
3977
if out_shape is not None :
3978
- if not (_is_list_or_turple_ (out_shape ) and len (out_shape ) == 2 ) and (
3979
- out_shape is not Variable ):
3980
- raise ValueError ('out_shape should be a list or tuple ' ,
3981
- 'with length 2, (out_h, out_w).' )
3978
+ if not (_is_list_or_turple_ (out_shape ) and
3979
+ len (out_shape ) == 2 ) and not isinstance (out_shape , Variable ):
3980
+ raise ValueError ('out_shape should be a list or tuple or variable' )
3982
3981
if _is_list_or_turple_ (out_shape ):
3983
3982
out_shape = list (map (int , out_shape ))
3984
3983
out_h = out_shape [0 ]
0 commit comments