Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
47bf4397
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
47bf4397
编写于
3月 19, 2022
作者:
P
phlrain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
c52d615f
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
31 addition
and
30 deletion
+31
-30
python/paddle/fluid/layers/layer_function_generator.py
python/paddle/fluid/layers/layer_function_generator.py
+2
-2
python/paddle/fluid/layers/loss.py
python/paddle/fluid/layers/loss.py
+3
-3
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+2
-2
python/paddle/fluid/tests/unittests/test_cumsum_op.py
python/paddle/fluid/tests/unittests/test_cumsum_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_eigh_op.py
python/paddle/fluid/tests/unittests/test_eigh_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_erfinv_op.py
python/paddle/fluid/tests/unittests/test_erfinv_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_imperative_gan.py
python/paddle/fluid/tests/unittests/test_imperative_gan.py
+1
-0
python/paddle/fluid/tests/unittests/test_imperative_optimizer.py
...paddle/fluid/tests/unittests/test_imperative_optimizer.py
+1
-0
python/paddle/fluid/tests/unittests/test_inplace_eager_fluid.py
.../paddle/fluid/tests/unittests/test_inplace_eager_fluid.py
+0
-1
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+3
-3
python/paddle/utils/code_gen/api.yaml
python/paddle/utils/code_gen/api.yaml
+13
-13
未找到文件。
python/paddle/fluid/layers/layer_function_generator.py
浏览文件 @
47bf4397
...
@@ -259,8 +259,8 @@ def generate_activation_fn(op_type):
...
@@ -259,8 +259,8 @@ def generate_activation_fn(op_type):
def
func
(
x
,
name
=
None
):
def
func
(
x
,
name
=
None
):
if
in_dygraph_mode
():
if
in_dygraph_mode
():
if
_in_eager_mode
():
if
_in_eager_mode
():
op
=
getattr
(
_C_ops
,
"final_state_"
+
op_type
)
if
hasattr
(
_C_ops
,
"final_state_"
+
op_type
):
if
op
:
op
=
getattr
(
_C_ops
,
"final_state_"
+
op_type
)
return
op
(
x
)
return
op
(
x
)
op
=
getattr
(
_C_ops
,
op_type
)
op
=
getattr
(
_C_ops
,
op_type
)
return
op
(
x
)
return
op
(
x
)
...
...
python/paddle/fluid/layers/loss.py
浏览文件 @
47bf4397
...
@@ -1458,9 +1458,9 @@ def sigmoid_cross_entropy_with_logits(x,
...
@@ -1458,9 +1458,9 @@ def sigmoid_cross_entropy_with_logits(x,
ignore_index=-1, normalize=True)
ignore_index=-1, normalize=True)
print(loss)
print(loss)
"""
"""
if
in_dygraph_mode
()
and
_in_eager_mode
():
#
if in_dygraph_mode() and _in_eager_mode():
return
_C_ops
.
final_state_sigmoid_cross_entropy_with_logits
(
#
return _C_ops.final_state_sigmoid_cross_entropy_with_logits(
x
,
label
,
normalize
,
ignore_index
)
#
x, label, normalize, ignore_index)
check_variable_and_dtype
(
x
,
'input'
,
[
'float16'
,
'float32'
,
'float64'
],
check_variable_and_dtype
(
x
,
'input'
,
[
'float16'
,
'float32'
,
'float64'
],
'sigmoid_cross_entropy_with_logits'
)
'sigmoid_cross_entropy_with_logits'
)
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
47bf4397
...
@@ -13329,8 +13329,8 @@ def log_loss(input, label, epsilon=1e-4, name=None):
...
@@ -13329,8 +13329,8 @@ def log_loss(input, label, epsilon=1e-4, name=None):
prob = paddle.randn((10,1))
prob = paddle.randn((10,1))
cost = F.log_loss(input=prob, label=label)
cost = F.log_loss(input=prob, label=label)
"""
"""
if in_dygraph_mode() and _in_eager_mode():
#
if in_dygraph_mode() and _in_eager_mode():
return _C_ops.final_state_log_loss(input, label, epsilon)
#
return _C_ops.final_state_log_loss(input, label, epsilon)
helper = LayerHelper('log_loss', **locals())
helper = LayerHelper('log_loss', **locals())
check_variable_and_dtype(input, 'input', ['float32'], 'log_loss')
check_variable_and_dtype(input, 'input', ['float32'], 'log_loss')
...
...
python/paddle/fluid/tests/unittests/test_cumsum_op.py
浏览文件 @
47bf4397
...
@@ -117,10 +117,10 @@ class TestSumOp1(OpTest):
...
@@ -117,10 +117,10 @@ class TestSumOp1(OpTest):
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
2
)}
self
.
outputs
=
{
'Out'
:
self
.
inputs
[
'X'
].
cumsum
(
axis
=
2
)}
def
test_check_output
(
self
):
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
Tru
e
)
self
.
check_output
(
check_eager
=
Fals
e
)
def
test_check_grad
(
self
):
def
test_check_grad
(
self
):
self
.
check_grad
([
'X'
],
'Out'
,
check_eager
=
Tru
e
)
self
.
check_grad
([
'X'
],
'Out'
,
check_eager
=
Fals
e
)
class
TestSumOp2
(
OpTest
):
class
TestSumOp2
(
OpTest
):
...
...
python/paddle/fluid/tests/unittests/test_eigh_op.py
浏览文件 @
47bf4397
...
@@ -43,10 +43,10 @@ class TestEighOp(OpTest):
...
@@ -43,10 +43,10 @@ class TestEighOp(OpTest):
self
.
x_np
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
self
.
x_type
)
self
.
x_np
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
self
.
x_type
)
def
test_check_output
(
self
):
def
test_check_output
(
self
):
self
.
check_output
(
no_check_set
=
[
'Eigenvectors'
],
check_eager
=
Tru
e
)
self
.
check_output
(
no_check_set
=
[
'Eigenvectors'
],
check_eager
=
Fals
e
)
def
test_grad
(
self
):
def
test_grad
(
self
):
self
.
check_grad
([
"X"
],
[
"Eigenvalues"
],
check_eager
=
Tru
e
)
self
.
check_grad
([
"X"
],
[
"Eigenvalues"
],
check_eager
=
Fals
e
)
class
TestEighUPLOCase
(
TestEighOp
):
class
TestEighUPLOCase
(
TestEighOp
):
...
...
python/paddle/fluid/tests/unittests/test_erfinv_op.py
浏览文件 @
47bf4397
...
@@ -42,7 +42,7 @@ class TestErfinv(OpTest):
...
@@ -42,7 +42,7 @@ class TestErfinv(OpTest):
self
.
dtype
=
np
.
float64
self
.
dtype
=
np
.
float64
def
test_check_output
(
self
):
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
Tru
e
)
self
.
check_output
(
check_eager
=
Fals
e
)
def
test_check_grad
(
self
):
def
test_check_grad
(
self
):
self
.
check_grad
(
self
.
check_grad
(
...
@@ -50,7 +50,7 @@ class TestErfinv(OpTest):
...
@@ -50,7 +50,7 @@ class TestErfinv(OpTest):
'Out'
,
'Out'
,
user_defined_grads
=
[
self
.
gradient
],
user_defined_grads
=
[
self
.
gradient
],
user_defined_grad_outputs
=
self
.
grad_out
,
user_defined_grad_outputs
=
self
.
grad_out
,
check_eager
=
Tru
e
)
check_eager
=
Fals
e
)
class
TestErfinvFP32
(
TestErfinv
):
class
TestErfinvFP32
(
TestErfinv
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_gan.py
浏览文件 @
47bf4397
...
@@ -235,4 +235,5 @@ class TestDygraphGAN(unittest.TestCase):
...
@@ -235,4 +235,5 @@ class TestDygraphGAN(unittest.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
paddle
.
enable_static
()
unittest
.
main
()
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_imperative_optimizer.py
浏览文件 @
47bf4397
...
@@ -876,4 +876,5 @@ class TestImperativeOptimizerList(unittest.TestCase):
...
@@ -876,4 +876,5 @@ class TestImperativeOptimizerList(unittest.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
paddle
.
enable_static
()
unittest
.
main
()
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_inplace_eager_fluid.py
浏览文件 @
47bf4397
...
@@ -160,7 +160,6 @@ class TestDygraphInplace(unittest.TestCase):
...
@@ -160,7 +160,6 @@ class TestDygraphInplace(unittest.TestCase):
var_a
.
stop_gradient
=
False
var_a
.
stop_gradient
=
False
var_b
=
var_a
**
2
var_b
=
var_a
**
2
var_c
=
self
.
non_inplace_api_processing
(
var_c
=
self
.
non_inplace_api_processing
(
var_b
)
# var_b is modified inplace before using it
var_b
)
# var_b is modified inplace before using it
...
...
python/paddle/tensor/math.py
浏览文件 @
47bf4397
...
@@ -322,8 +322,8 @@ def subtract(x, y, name=None):
...
@@ -322,8 +322,8 @@ def subtract(x, y, name=None):
axis
=
-
1
axis
=
-
1
act
=
None
act
=
None
if
paddle
.
in_dynamic_mode
():
if
paddle
.
in_dynamic_mode
():
if
_in_eager_mode
():
#
if _in_eager_mode():
return
_C_ops
.
final_state_subtract
(
x
,
y
)
#
return _C_ops.final_state_subtract( x, y)
return
_elementwise_op_in_dygraph
(
return
_elementwise_op_in_dygraph
(
x
,
y
,
axis
=
axis
,
act
=
act
,
op_name
=
op_type
)
x
,
y
,
axis
=
axis
,
act
=
act
,
op_name
=
op_type
)
return
_elementwise_op
(
LayerHelper
(
op_type
,
**
locals
()))
return
_elementwise_op
(
LayerHelper
(
op_type
,
**
locals
()))
...
@@ -2822,7 +2822,7 @@ def sign(x, name=None):
...
@@ -2822,7 +2822,7 @@ def sign(x, name=None):
print(out) # [1.0, 0.0, -1.0, 1.0]
print(out) # [1.0, 0.0, -1.0, 1.0]
"""
"""
if
paddle
.
in_dynamic_mode
():
if
paddle
.
in_dynamic_mode
():
if
_in_eager_mode
l
():
if
_in_eager_mode
():
return
_C_op
.
final_state_sign
(
x
)
return
_C_op
.
final_state_sign
(
x
)
return
_C_ops
.
sign
(
x
)
return
_C_ops
.
sign
(
x
)
...
...
python/paddle/utils/code_gen/api.yaml
浏览文件 @
47bf4397
...
@@ -296,7 +296,7 @@
...
@@ -296,7 +296,7 @@
param
:
[
index
]
param
:
[
index
]
kernel
:
kernel
:
func
:
put_along_axis
func
:
put_along_axis
dtype
:
x
d
ata_
type
:
x
backward
:
put_along_axis_grad
backward
:
put_along_axis_grad
...
@@ -309,7 +309,7 @@
...
@@ -309,7 +309,7 @@
param
:
[
index
]
param
:
[
index
]
kernel
:
kernel
:
func
:
take_along_axis
func
:
take_along_axis
dtype
:
x
d
ata_
type
:
x
backward
:
take_along_axis_grad
backward
:
take_along_axis_grad
# matrix_power
# matrix_power
...
@@ -597,7 +597,7 @@
...
@@ -597,7 +597,7 @@
backward
:
hard_sigmoid_grad
backward
:
hard_sigmoid_grad
# arg_min # int64
????
dtype
# arg_min # int64 dtype
-
api
:
argmin
-
api
:
argmin
args
:
(Tensor x, int64 axis, bool keepdims, bool flatten, int dtype)
args
:
(Tensor x, int64 axis, bool keepdims, bool flatten, int dtype)
output
:
Tensor
output
:
Tensor
...
@@ -606,7 +606,7 @@
...
@@ -606,7 +606,7 @@
kernel
:
kernel
:
func
:
arg_min
func
:
arg_min
# arg_max # int64
????
dtype
# arg_max # int64 dtype
-
api
:
argmax
-
api
:
argmax
args
:
(Tensor x, int64 axis, bool keepdims, bool flatten, int dtype)
args
:
(Tensor x, int64 axis, bool keepdims, bool flatten, int dtype)
output
:
Tensor
output
:
Tensor
...
@@ -757,7 +757,7 @@
...
@@ -757,7 +757,7 @@
func
:
cumsum
func
:
cumsum
# # depthwise_conv2d
# # depthwise_conv2d
# # dropout
??
optional, intermediate
# # dropout optional, intermediate
# - api : dropout
# - api : dropout
# args : (Tensor x, Tensor seed_tensor, float p, bool is_test, str mode, int seed, bool fix_seed)
# args : (Tensor x, Tensor seed_tensor, float p, bool is_test, str mode, int seed, bool fix_seed)
# output : Tensor(out), Tensor(mask)
# output : Tensor(out), Tensor(mask)
...
@@ -849,7 +849,7 @@
...
@@ -849,7 +849,7 @@
# func : graph_send_recv
# func : graph_send_recv
# backward : graph_send_recv_grad
# backward : graph_send_recv_grad
# # histogram int64
???
# # histogram int64
# - api : histogram
# - api : histogram
# args : (Tensor x, int64 bins, int min, int max)
# args : (Tensor x, int64 bins, int min, int max)
# output : Tensor
# output : Tensor
...
@@ -876,7 +876,7 @@
...
@@ -876,7 +876,7 @@
kernel
:
kernel
:
func
:
is_empty
func
:
is_empty
# # isinf selected rows
???
involk
# # isinf selected rows involk
# - api : isinf
# - api : isinf
# args : (Tensor x)
# args : (Tensor x)
# output : Tensor
# output : Tensor
...
@@ -885,7 +885,7 @@
...
@@ -885,7 +885,7 @@
# kernel :
# kernel :
# func : isinf
# func : isinf
# # isnan selected rows
???
involk
# # isnan selected rows involk
# - api : isnan
# - api : isnan
# args : (Tensor x)
# args : (Tensor x)
# output : Tensor
# output : Tensor
...
@@ -894,7 +894,7 @@
...
@@ -894,7 +894,7 @@
# kernel :
# kernel :
# func : isnan
# func : isnan
# # isfinite selected rows
???
involk
# # isfinite selected rows involk
# - api : isfinite
# - api : isfinite
# args : (Tensor x)
# args : (Tensor x)
# output : Tensor
# output : Tensor
...
@@ -903,7 +903,7 @@
...
@@ -903,7 +903,7 @@
# kernel :
# kernel :
# func : isfinite
# func : isfinite
# label_smooth
??
optional
# label_smooth optional
# - api : label_smooth
# - api : label_smooth
# args : (Tensor label, Tensor prior_dist, float epsilon)
# args : (Tensor label, Tensor prior_dist, float epsilon)
# output : Tensor
# output : Tensor
...
@@ -915,7 +915,7 @@
...
@@ -915,7 +915,7 @@
# backward : label_smooth_grad
# backward : label_smooth_grad
# optional : prior_dist
# optional : prior_dist
# linspace
????
start stop number
# linspace start stop number
# - api : linspace
# - api : linspace
# args : (Tensor start, Tensor stop, Tensor number, DataType dtype=DataType::FLOAT32)
# args : (Tensor start, Tensor stop, Tensor number, DataType dtype=DataType::FLOAT32)
# output : Tensor
# output : Tensor
...
@@ -1042,7 +1042,7 @@
...
@@ -1042,7 +1042,7 @@
# func : poisson
# func : poisson
# backward : poisson_grad
# backward : poisson_grad
# psroi_pool
??
optional
# psroi_pool optional
# - api : psroi_pool
# - api : psroi_pool
# args : (Tensor x, Tensor rois, Tensor rois_num, int pooled_weight, int pooled_width, int output_channels, float spatial_scale )
# args : (Tensor x, Tensor rois, Tensor rois_num, int pooled_weight, int pooled_width, int output_channels, float spatial_scale )
# output : Tensor
# output : Tensor
...
@@ -1103,7 +1103,7 @@
...
@@ -1103,7 +1103,7 @@
# # set_value None api
# # set_value None api
# # sgd # need invoke
# # sgd # need invoke
# # shape
???
selcted rows
# # shape selcted rows
# shard_index
# shard_index
-
api
:
shard_index
-
api
:
shard_index
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录