Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f8ac6c2c
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f8ac6c2c
编写于
6月 04, 2020
作者:
W
wangchaochaohu
提交者:
GitHub
6月 04, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fp16 support of assgin Op and squeeze Op test=develop (#24862)
上级
8abab77d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
45 deletion
+46
-45
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+4
-4
python/paddle/fluid/layers/tensor.py
python/paddle/fluid/layers/tensor.py
+42
-41
未找到文件。
python/paddle/fluid/layers/nn.py
浏览文件 @
f8ac6c2c
...
@@ -6175,7 +6175,7 @@ def squeeze(input, axes, name=None):
...
@@ -6175,7 +6175,7 @@ def squeeze(input, axes, name=None):
Out.shape = [1,3,5]
Out.shape = [1,3,5]
Args:
Args:
input (Variable): The input Tensor. Support data type: float32, float64, int8, int32, int64.
input (Variable): The input Tensor. Support data type: float
16, float
32, float64, int8, int32, int64.
axes (list): One integer or List of integers, indicating the dimensions to be squeezed.
axes (list): One integer or List of integers, indicating the dimensions to be squeezed.
Axes range is :math:`[-rank(input), rank(input))`.
Axes range is :math:`[-rank(input), rank(input))`.
If axes is negative, :math:`axes=axes+rank(input)`.
If axes is negative, :math:`axes=axes+rank(input)`.
...
@@ -6195,9 +6195,9 @@ def squeeze(input, axes, name=None):
...
@@ -6195,9 +6195,9 @@ def squeeze(input, axes, name=None):
"""
"""
helper = LayerHelper("squeeze", **locals())
helper = LayerHelper("squeeze", **locals())
check_variable_and_dtype(
input, 'input',
check_variable_and_dtype(
['float32', 'float64', 'int8', 'int32', 'int64']
,
input, 'input'
,
'squeeze')
['float16', 'float32', 'float64', 'int8', 'int32', 'int64'],
'squeeze')
check_type(axes, 'axes', list, 'squeeze')
check_type(axes, 'axes', list, 'squeeze')
out = helper.create_variable_for_type_inference(dtype=input.dtype)
out = helper.create_variable_for_type_inference(dtype=input.dtype)
x_shape = helper.create_variable_for_type_inference(dtype=input.dtype)
x_shape = helper.create_variable_for_type_inference(dtype=input.dtype)
...
...
python/paddle/fluid/layers/tensor.py
浏览文件 @
f8ac6c2c
...
@@ -75,7 +75,7 @@ def create_parameter(shape,
...
@@ -75,7 +75,7 @@ def create_parameter(shape,
is_bias
=
False
,
is_bias
=
False
,
default_initializer
=
None
):
default_initializer
=
None
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
This function creates a parameter. The parameter is a learnable variable, which can have
This function creates a parameter. The parameter is a learnable variable, which can have
gradient, and can be optimized.
gradient, and can be optimized.
...
@@ -197,9 +197,9 @@ def create_global_var(shape,
...
@@ -197,9 +197,9 @@ def create_global_var(shape,
def
cast
(
x
,
dtype
):
def
cast
(
x
,
dtype
):
"""
"""
:alias_main: paddle.cast
:alias_main: paddle.cast
:alias: paddle.cast,paddle.tensor.cast,paddle.tensor.manipulation.cast
:alias: paddle.cast,paddle.tensor.cast,paddle.tensor.manipulation.cast
:old_api: paddle.fluid.layers.cast
:old_api: paddle.fluid.layers.cast
This OP takes in the Variable :attr:`x` with :attr:`x.dtype` and casts it
This OP takes in the Variable :attr:`x` with :attr:`x.dtype` and casts it
to the output with :attr:`dtype`. It's meaningless if the output dtype
to the output with :attr:`dtype`. It's meaningless if the output dtype
...
@@ -263,9 +263,9 @@ def cast(x, dtype):
...
@@ -263,9 +263,9 @@ def cast(x, dtype):
def
concat
(
input
,
axis
=
0
,
name
=
None
):
def
concat
(
input
,
axis
=
0
,
name
=
None
):
"""
"""
:alias_main: paddle.concat
:alias_main: paddle.concat
:alias: paddle.concat,paddle.tensor.concat,paddle.tensor.manipulation.concat
:alias: paddle.concat,paddle.tensor.concat,paddle.tensor.manipulation.concat
:old_api: paddle.fluid.layers.concat
:old_api: paddle.fluid.layers.concat
**Concat**
**Concat**
...
@@ -545,15 +545,15 @@ def sums(input, out=None):
...
@@ -545,15 +545,15 @@ def sums(input, out=None):
def
assign
(
input
,
output
=
None
):
def
assign
(
input
,
output
=
None
):
"""
"""
:alias_main: paddle.nn.functional.assign
:alias_main: paddle.nn.functional.assign
:alias: paddle.nn.functional.assign,paddle.nn.functional.common.assign
:alias: paddle.nn.functional.assign,paddle.nn.functional.common.assign
:old_api: paddle.fluid.layers.assign
:old_api: paddle.fluid.layers.assign
The OP copies the :attr:`input` to the :attr:`output`.
The OP copies the :attr:`input` to the :attr:`output`.
Parameters:
Parameters:
input (Variable|numpy.ndarray): A tensor or numpy ndarray, its data type supports
input (Variable|numpy.ndarray): A tensor or numpy ndarray, its data type supports
float32, float64, int32 and int64.
float
16, float
32, float64, int32 and int64.
output (Variable, optional): A tensor. If :attr:`output` is None, a new tensor will
output (Variable, optional): A tensor. If :attr:`output` is None, a new tensor will
be created as :attr:`output`. Default: None.
be created as :attr:`output`. Default: None.
...
@@ -574,9 +574,10 @@ def assign(input, output=None):
...
@@ -574,9 +574,10 @@ def assign(input, output=None):
helper
=
LayerHelper
(
'assign'
,
**
locals
())
helper
=
LayerHelper
(
'assign'
,
**
locals
())
check_type
(
input
,
'input'
,
(
Variable
,
numpy
.
ndarray
),
'assign'
)
check_type
(
input
,
'input'
,
(
Variable
,
numpy
.
ndarray
),
'assign'
)
if
isinstance
(
input
,
Variable
):
if
isinstance
(
input
,
Variable
):
check_dtype
(
input
.
dtype
,
'input'
,
check_dtype
(
[
'float32'
,
'float64'
,
'int32'
,
'int64'
,
'bool'
],
'assign'
,
input
.
dtype
,
'input'
,
'(When the type of input in assign is Variable.)'
)
[
'float16'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
,
'bool'
],
'assign'
,
'(When the type of input in assign is Variable.)'
)
if
output
is
None
:
if
output
is
None
:
output
=
helper
.
create_variable_for_type_inference
(
output
=
helper
.
create_variable_for_type_inference
(
dtype
=
input
.
dtype
)
dtype
=
input
.
dtype
)
...
@@ -621,9 +622,9 @@ def assign(input, output=None):
...
@@ -621,9 +622,9 @@ def assign(input, output=None):
def
fill_constant
(
shape
,
dtype
,
value
,
force_cpu
=
False
,
out
=
None
):
def
fill_constant
(
shape
,
dtype
,
value
,
force_cpu
=
False
,
out
=
None
):
"""
"""
:alias_main: paddle.fill_constant
:alias_main: paddle.fill_constant
:alias: paddle.fill_constant,paddle.tensor.fill_constant,paddle.tensor.creation.fill_constant
:alias: paddle.fill_constant,paddle.tensor.fill_constant,paddle.tensor.creation.fill_constant
:old_api: paddle.fluid.layers.fill_constant
:old_api: paddle.fluid.layers.fill_constant
This OP creates a Tensor with specified `shape` and `dtype`, and
This OP creates a Tensor with specified `shape` and `dtype`, and
initializes it with a constant specified by `value`.
initializes it with a constant specified by `value`.
...
@@ -805,9 +806,9 @@ def fill_constant_batch_size_like(input,
...
@@ -805,9 +806,9 @@ def fill_constant_batch_size_like(input,
def
argmin
(
x
,
axis
=
0
):
def
argmin
(
x
,
axis
=
0
):
"""
"""
:alias_main: paddle.argmin
:alias_main: paddle.argmin
:alias: paddle.argmin,paddle.tensor.argmin,paddle.tensor.search.argmin
:alias: paddle.argmin,paddle.tensor.argmin,paddle.tensor.search.argmin
:old_api: paddle.fluid.layers.argmin
:old_api: paddle.fluid.layers.argmin
**argmin**
**argmin**
...
@@ -935,9 +936,9 @@ def argmax(x, axis=0):
...
@@ -935,9 +936,9 @@ def argmax(x, axis=0):
def
argsort
(
input
,
axis
=-
1
,
descending
=
False
,
name
=
None
):
def
argsort
(
input
,
axis
=-
1
,
descending
=
False
,
name
=
None
):
"""
"""
:alias_main: paddle.argsort
:alias_main: paddle.argsort
:alias: paddle.argsort,paddle.tensor.argsort,paddle.tensor.search.argsort
:alias: paddle.argsort,paddle.tensor.argsort,paddle.tensor.search.argsort
:old_api: paddle.fluid.layers.argsort
:old_api: paddle.fluid.layers.argsort
This OP sorts the input along the given axis, and returns sorted output
This OP sorts the input along the given axis, and returns sorted output
data Varibale and its corresponding index Variable with the same shape as
data Varibale and its corresponding index Variable with the same shape as
...
@@ -1087,9 +1088,9 @@ def zeros(shape, dtype, force_cpu=False):
...
@@ -1087,9 +1088,9 @@ def zeros(shape, dtype, force_cpu=False):
def
reverse
(
x
,
axis
):
def
reverse
(
x
,
axis
):
"""
"""
:alias_main: paddle.reverse
:alias_main: paddle.reverse
:alias: paddle.reverse,paddle.tensor.reverse,paddle.tensor.manipulation.reverse
:alias: paddle.reverse,paddle.tensor.reverse,paddle.tensor.manipulation.reverse
:old_api: paddle.fluid.layers.reverse
:old_api: paddle.fluid.layers.reverse
The OP reverses the tensor :attr:`x` along the given :attr:`axis`.
The OP reverses the tensor :attr:`x` along the given :attr:`axis`.
...
@@ -1201,9 +1202,9 @@ def load_combine(out, file_path):
...
@@ -1201,9 +1202,9 @@ def load_combine(out, file_path):
def
has_inf
(
x
):
def
has_inf
(
x
):
"""
"""
:alias_main: paddle.has_inf
:alias_main: paddle.has_inf
:alias: paddle.has_inf,paddle.tensor.has_inf,paddle.tensor.search.has_inf
:alias: paddle.has_inf,paddle.tensor.has_inf,paddle.tensor.search.has_inf
:old_api: paddle.fluid.layers.has_inf
:old_api: paddle.fluid.layers.has_inf
Test if any of x contains an infinity number
Test if any of x contains an infinity number
...
@@ -1230,9 +1231,9 @@ def has_inf(x):
...
@@ -1230,9 +1231,9 @@ def has_inf(x):
def
has_nan
(
x
):
def
has_nan
(
x
):
"""
"""
:alias_main: paddle.has_nan
:alias_main: paddle.has_nan
:alias: paddle.has_nan,paddle.tensor.has_nan,paddle.tensor.search.has_nan
:alias: paddle.has_nan,paddle.tensor.has_nan,paddle.tensor.search.has_nan
:old_api: paddle.fluid.layers.has_nan
:old_api: paddle.fluid.layers.has_nan
Test if any of x contains a NAN
Test if any of x contains a NAN
...
@@ -1259,9 +1260,9 @@ def has_nan(x):
...
@@ -1259,9 +1260,9 @@ def has_nan(x):
def
isfinite
(
x
):
def
isfinite
(
x
):
"""
"""
:alias_main: paddle.isfinite
:alias_main: paddle.isfinite
:alias: paddle.isfinite,paddle.tensor.isfinite,paddle.tensor.logic.isfinite
:alias: paddle.isfinite,paddle.tensor.isfinite,paddle.tensor.logic.isfinite
:old_api: paddle.fluid.layers.isfinite
:old_api: paddle.fluid.layers.isfinite
Test if any of x contains an infinity/NAN number. If all the elements are finite,
Test if any of x contains an infinity/NAN number. If all the elements are finite,
returns true, else false.
returns true, else false.
...
@@ -1460,9 +1461,9 @@ def zeros_like(x, out=None):
...
@@ -1460,9 +1461,9 @@ def zeros_like(x, out=None):
def
diag
(
diagonal
):
def
diag
(
diagonal
):
"""
"""
:alias_main: paddle.diag
:alias_main: paddle.diag
:alias: paddle.diag,paddle.tensor.diag,paddle.tensor.creation.diag
:alias: paddle.diag,paddle.tensor.diag,paddle.tensor.creation.diag
:old_api: paddle.fluid.layers.diag
:old_api: paddle.fluid.layers.diag
This OP creates a square matrix which has diagonal values specified by input :attr:`diagonal`.
This OP creates a square matrix which has diagonal values specified by input :attr:`diagonal`.
...
@@ -1507,9 +1508,9 @@ def diag(diagonal):
...
@@ -1507,9 +1508,9 @@ def diag(diagonal):
def
eye
(
num_rows
,
num_columns
=
None
,
batch_shape
=
None
,
dtype
=
'float32'
):
def
eye
(
num_rows
,
num_columns
=
None
,
batch_shape
=
None
,
dtype
=
'float32'
):
"""
"""
:alias_main: paddle.eye
:alias_main: paddle.eye
:alias: paddle.eye,paddle.tensor.eye,paddle.tensor.creation.eye
:alias: paddle.eye,paddle.tensor.eye,paddle.tensor.creation.eye
:old_api: paddle.fluid.layers.eye
:old_api: paddle.fluid.layers.eye
**eye**
**eye**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录