Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b5ac40ba
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b5ac40ba
编写于
8月 17, 2023
作者:
O
Orkun Özoğlu
提交者:
GitHub
8月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docstrings to reflect functions accepting Tensors. (#56379)
上级
edfc1ab8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
20 deletion
+20
-20
python/paddle/vision/transforms/functional.py
python/paddle/vision/transforms/functional.py
+20
-20
未找到文件。
python/paddle/vision/transforms/functional.py
浏览文件 @
b5ac40ba
...
@@ -104,7 +104,7 @@ def resize(img, size, interpolation='bilinear'):
...
@@ -104,7 +104,7 @@ def resize(img, size, interpolation='bilinear'):
Resizes the image to given size
Resizes the image to given size
Args:
Args:
input (PIL.Image|np.ndarray): Image to be resized.
input (PIL.Image|np.ndarray
|paddle.Tensor
): Image to be resized.
size (int|list|tuple): Target size of input data, with (height, width) shape.
size (int|list|tuple): Target size of input data, with (height, width) shape.
interpolation (int|str, optional): Interpolation method. when use pil backend,
interpolation (int|str, optional): Interpolation method. when use pil backend,
support method are as following:
support method are as following:
...
@@ -122,7 +122,7 @@ def resize(img, size, interpolation='bilinear'):
...
@@ -122,7 +122,7 @@ def resize(img, size, interpolation='bilinear'):
- "lanczos": cv2.INTER_LANCZOS4
- "lanczos": cv2.INTER_LANCZOS4
Returns:
Returns:
PIL.Image
or np.array
: Resized image.
PIL.Image
|np.array|paddle.Tensor
: Resized image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -162,10 +162,10 @@ def resize(img, size, interpolation='bilinear'):
...
@@ -162,10 +162,10 @@ def resize(img, size, interpolation='bilinear'):
def
pad
(
img
,
padding
,
fill
=
0
,
padding_mode
=
'constant'
):
def
pad
(
img
,
padding
,
fill
=
0
,
padding_mode
=
'constant'
):
"""
"""
Pads the given PIL.Image or numpy.array on all sides with specified padding mode and fill value.
Pads the given PIL.Image or numpy.array o
r paddle.Tensor o
n all sides with specified padding mode and fill value.
Args:
Args:
img (PIL.Image|np.array): Image to be padded.
img (PIL.Image|np.array
|paddle.Tensor
): Image to be padded.
padding (int|list|tuple): Padding on each border. If a single int is provided this
padding (int|list|tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If list/tuple of length 2 is provided this is the padding
is used to pad all borders. If list/tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
...
@@ -191,7 +191,7 @@ def pad(img, padding, fill=0, padding_mode='constant'):
...
@@ -191,7 +191,7 @@ def pad(img, padding, fill=0, padding_mode='constant'):
will result in [2, 1, 1, 2, 3, 4, 4, 3]
will result in [2, 1, 1, 2, 3, 4, 4, 3]
Returns:
Returns:
PIL.Image
or np.array
: Padded image.
PIL.Image
|np.array|paddle.Tensor
: Padded image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -231,7 +231,7 @@ def crop(img, top, left, height, width):
...
@@ -231,7 +231,7 @@ def crop(img, top, left, height, width):
"""Crops the given Image.
"""Crops the given Image.
Args:
Args:
img (PIL.Image|np.array): Image to be cropped. (0,0) denotes the top left
img (PIL.Image|np.array
|paddle.Tensor
): Image to be cropped. (0,0) denotes the top left
corner of the image.
corner of the image.
top (int): Vertical component of the top left corner of the crop box.
top (int): Vertical component of the top left corner of the crop box.
left (int): Horizontal component of the top left corner of the crop box.
left (int): Horizontal component of the top left corner of the crop box.
...
@@ -239,7 +239,7 @@ def crop(img, top, left, height, width):
...
@@ -239,7 +239,7 @@ def crop(img, top, left, height, width):
width (int): Width of the crop box.
width (int): Width of the crop box.
Returns:
Returns:
PIL.Image
or np.array
: Cropped image.
PIL.Image
|np.array|paddle.Tensor
: Cropped image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -277,12 +277,12 @@ def center_crop(img, output_size):
...
@@ -277,12 +277,12 @@ def center_crop(img, output_size):
"""Crops the given Image and resize it to desired size.
"""Crops the given Image and resize it to desired size.
Args:
Args:
img (PIL.Image|np.array): Image to be cropped. (0,0) denotes the top left corner of the image.
img (PIL.Image|np.array
|paddle.Tensor
): Image to be cropped. (0,0) denotes the top left corner of the image.
output_size (sequence or int): (height, width) of the crop box. If int,
output_size (sequence or int): (height, width) of the crop box. If int,
it is used for both directions
it is used for both directions
Returns:
Returns:
PIL.Image
or np.array
: Cropped image.
PIL.Image
|np.array|paddle.Tensor
: Cropped image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -316,13 +316,13 @@ def center_crop(img, output_size):
...
@@ -316,13 +316,13 @@ def center_crop(img, output_size):
def
hflip
(
img
):
def
hflip
(
img
):
"""Horizontally flips the given Image or np.array.
"""Horizontally flips the given Image or np.array
or paddle.Tensor
.
Args:
Args:
img (PIL.Image|np.array): Image to be flipped.
img (PIL.Image|np.array
|Tensor
): Image to be flipped.
Returns:
Returns:
PIL.Image
or np.array
: Horizontall flipped image.
PIL.Image
|np.array|paddle.Tensor
: Horizontall flipped image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -357,13 +357,13 @@ def hflip(img):
...
@@ -357,13 +357,13 @@ def hflip(img):
def
vflip
(
img
):
def
vflip
(
img
):
"""Vertically flips the given Image or np.array.
"""Vertically flips the given Image or np.array
or paddle.Tensor
.
Args:
Args:
img (PIL.Image|np.array): Image to be flipped.
img (PIL.Image|np.array
|paddle.Tensor
): Image to be flipped.
Returns:
Returns:
PIL.Image
or np.array
: Vertically flipped image.
PIL.Image
|np.array|paddle.Tensor
: Vertically flipped image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -760,7 +760,7 @@ def rotate(
...
@@ -760,7 +760,7 @@ def rotate(
Args:
Args:
img (PIL.Image|np.array): Image to be rotated.
img (PIL.Image|np.array
|paddle.Tensor
): Image to be rotated.
angle (float or int): In degrees degrees counter clockwise order.
angle (float or int): In degrees degrees counter clockwise order.
interpolation (str, optional): Interpolation method. If omitted, or if the
interpolation (str, optional): Interpolation method. If omitted, or if the
image has only one channel, it is set to PIL.Image.NEAREST or cv2.INTER_NEAREST
image has only one channel, it is set to PIL.Image.NEAREST or cv2.INTER_NEAREST
...
@@ -784,7 +784,7 @@ def rotate(
...
@@ -784,7 +784,7 @@ def rotate(
Returns:
Returns:
PIL.Image
or np.array
: Rotated image.
PIL.Image
|np.array|paddle.Tensor
: Rotated image.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -934,11 +934,11 @@ def to_grayscale(img, num_output_channels=1):
...
@@ -934,11 +934,11 @@ def to_grayscale(img, num_output_channels=1):
"""Converts image to grayscale version of image.
"""Converts image to grayscale version of image.
Args:
Args:
img (PIL.Image|np.array): Image to be converted to grayscale.
img (PIL.Image|np.array
|paddle.Tensor
): Image to be converted to grayscale.
num_output_channels (int, optional): The number of channels for the output
num_output_channels (int, optional): The number of channels for the output
image. Single channel. Default: 1.
image. Single channel. Default: 1.
Returns:
Returns:
PIL.Image
or np.array
: Grayscale version of the image.
PIL.Image
|np.array|paddle.Tensor
: Grayscale version of the image.
if num_output_channels = 1 : returned image is single channel
if num_output_channels = 1 : returned image is single channel
if num_output_channels = 3 : returned image is 3 channel with r = g = b
if num_output_channels = 3 : returned image is 3 channel with r = g = b
...
@@ -988,7 +988,7 @@ def normalize(img, mean, std, data_format='CHW', to_rgb=False):
...
@@ -988,7 +988,7 @@ def normalize(img, mean, std, data_format='CHW', to_rgb=False):
this option will be igored. Default: False.
this option will be igored. Default: False.
Returns:
Returns:
np.ndarray or
Tensor: Normalized mage. Data format is same as input img.
PIL.Image|np.array|paddle.
Tensor: Normalized mage. Data format is same as input img.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录