diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 3e7d10f8d1a02126c3d4bec490fcd2f3194123ee..87a1971747e84ffa1db4ebcce29941d577d2df24 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -13391,7 +13391,7 @@ def temporal_shift(x, seg_num, shift_ratio=0.25, name=None): ${comment} Args: - x(Variable): ${x_comment} + x(Tensor): ${x_comment} seg_num(int): ${seg_num_comment} shift_ratio(float): ${shift_ratio_comment} name(str, optional): For detailed information, please refer @@ -13399,7 +13399,7 @@ def temporal_shift(x, seg_num, shift_ratio=0.25, name=None): None by default. Returns: - out(Variable): The temporal shifting result is a tensor variable with the + out(Tensor): The temporal shifting result is a tensor with the same shape and same data type as the input. Raises: @@ -13408,9 +13408,11 @@ def temporal_shift(x, seg_num, shift_ratio=0.25, name=None): Examples: .. code-block:: python - import paddle.fluid as fluid - input = fluid.data(name='input', shape=[None,4,2,2], dtype='float32') - out = fluid.layers.temporal_shift(x=input, seg_num=2, shift_ratio=0.2) + import paddle + import paddle.nn.functional as F + + input = paddle.randn([3, 4, 2, 2]) + out = F.temporal_shift(x=input, seg_num=2, shift_ratio=0.2) """ helper = LayerHelper("temporal_shift", **locals()) check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'temporal_shift') diff --git a/python/paddle/nn/functional/vision.py b/python/paddle/nn/functional/vision.py index a74a98d5ed45b9f613b0f2f6d5f04544ffae3d2a..935b9881e5943da1aa001538dbddc35d08c4902e 100644 --- a/python/paddle/nn/functional/vision.py +++ b/python/paddle/nn/functional/vision.py @@ -34,7 +34,6 @@ from ...fluid.layers import distribute_fpn_proposals #DEFINE_ALIAS from ...fluid.layers import generate_mask_labels #DEFINE_ALIAS from ...fluid.layers import generate_proposal_labels #DEFINE_ALIAS from ...fluid.layers import generate_proposals #DEFINE_ALIAS -from ...fluid.layers import grid_sampler #DEFINE_ALIAS from ...fluid.layers import image_resize #DEFINE_ALIAS from ...fluid.layers import prior_box #DEFINE_ALIAS from ...fluid.layers import prroi_pool #DEFINE_ALIAS @@ -74,7 +73,7 @@ __all__ = [ 'generate_mask_labels', 'generate_proposal_labels', 'generate_proposals', - 'grid_sampler', + 'grid_sample', 'image_resize', 'image_resize_short', # 'multi_box_head', @@ -304,13 +303,13 @@ def grid_sample(x, # [ 0.596 0.38 0.52 0.24 ]]]] """ helper = LayerHelper("grid_sample", **locals()) - check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'grid_sampler') + check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'grid_sample') check_variable_and_dtype(grid, 'grid', ['float32', 'float64'], - 'grid_sampler') + 'grid_sample') if not isinstance(x, Variable): - raise ValueError("The x should be a Variable") + raise ValueError("The x should be a Tensor") if not isinstance(grid, Variable): - raise ValueError("The grid should be a Variable") + raise ValueError("The grid should be a Tensor") _modes = ['bilinear', 'nearest'] _padding_modes = ['zeros', 'reflection', 'border'] if mode not in _modes: