Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
be85ecc9
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
be85ecc9
编写于
12月 25, 2020
作者:
L
LielinJiang
提交者:
GitHub
12月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update en docs of to_tensor (#29718) (#29901)
* update to_tensor en docs
上级
41917fb5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
9 deletion
+15
-9
python/paddle/vision/transforms/functional.py
python/paddle/vision/transforms/functional.py
+2
-2
python/paddle/vision/transforms/functional_cv2.py
python/paddle/vision/transforms/functional_cv2.py
+1
-1
python/paddle/vision/transforms/functional_pil.py
python/paddle/vision/transforms/functional_pil.py
+1
-1
python/paddle/vision/transforms/transforms.py
python/paddle/vision/transforms/transforms.py
+11
-5
未找到文件。
python/paddle/vision/transforms/functional.py
浏览文件 @
be85ecc9
...
...
@@ -62,11 +62,11 @@ def to_tensor(pic, data_format='CHW'):
Args:
pic (PIL.Image|np.ndarray): Image to be converted to tensor.
data_format (str, optional): Data format of
input img
, should be 'HWC' or
data_format (str, optional): Data format of
output tensor
, should be 'HWC' or
'CHW'. Default: 'CHW'.
Returns:
Tensor: Converted image. Data
format
is same as input img.
Tensor: Converted image. Data
type
is same as input img.
Examples:
.. code-block:: python
...
...
python/paddle/vision/transforms/functional_cv2.py
浏览文件 @
be85ecc9
...
...
@@ -40,7 +40,7 @@ def to_tensor(pic, data_format='CHW'):
Args:
pic (np.ndarray): Image to be converted to tensor.
data_format (str, optional): Data format of
img
, should be 'HWC' or
data_format (str, optional): Data format of
output tensor
, should be 'HWC' or
'CHW'. Default: 'CHW'.
Returns:
...
...
python/paddle/vision/transforms/functional_pil.py
浏览文件 @
be85ecc9
...
...
@@ -49,7 +49,7 @@ def to_tensor(pic, data_format='CHW'):
Args:
pic (PIL.Image): Image to be converted to tensor.
data_format (str, optional): Data format of
img
, should be 'HWC' or
data_format (str, optional): Data format of
output tensor
, should be 'HWC' or
'CHW'. Default: 'CHW'.
Returns:
...
...
python/paddle/vision/transforms/transforms.py
浏览文件 @
be85ecc9
...
...
@@ -296,15 +296,21 @@ class BaseTransform(object):
class
ToTensor
(
BaseTransform
):
"""Convert a ``PIL.Image`` or ``numpy.ndarray`` to ``paddle.Tensor``.
Converts a PIL.Image or numpy.ndarray (H x W x C) in the range
[0, 255] to a paddle.Tensor of shape (C x H x W) in the range [0.0, 1.0]
if the PIL Image belongs to one of the modes (L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK, 1)
or if the numpy.ndarray has dtype = np.uint8
Converts a PIL.Image or numpy.ndarray (H x W x C) to a paddle.Tensor of shape (C x H x W).
If input is a grayscale image (H x W), it will be converted to a image of shape (H x W x 1).
And the shape of output tensor will be (1 x H x W).
If you want to keep the shape of output tensor as (H x W x C), you can set data_format = ``HWC`` .
Converts a PIL.Image or numpy.ndarray in the range [0, 255] to a paddle.Tensor in the
range [0.0, 1.0] if the PIL Image belongs to one of the modes (L, LA, P, I, F, RGB, YCbCr,
RGBA, CMYK, 1) or if the numpy.ndarray has dtype = np.uint8.
In the other cases, tensors are returned without scaling.
Args:
data_format (str, optional): Data format of
input img
, should be 'HWC' or
data_format (str, optional): Data format of
output tensor
, should be 'HWC' or
'CHW'. Default: 'CHW'.
keys (list[str]|tuple[str], optional): Same as ``BaseTransform``. Default: None.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录