提交 929a2b4b 编写于 作者: L LielinJiang

refine 2.0 api

上级 6b727e08
......@@ -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')
......
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册