Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
9e24fa3a
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9e24fa3a
编写于
12月 20, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish code
test=develop
上级
1c116462
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
13 deletion
+0
-13
paddle/fluid/imperative/layer.cc
paddle/fluid/imperative/layer.cc
+0
-5
paddle/fluid/operators/cross_entropy_op.h
paddle/fluid/operators/cross_entropy_op.h
+0
-2
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+0
-4
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
+0
-2
未找到文件。
paddle/fluid/imperative/layer.cc
浏览文件 @
9e24fa3a
...
@@ -115,7 +115,6 @@ framework::Variable* CreateVariable(const std::string& name,
...
@@ -115,7 +115,6 @@ framework::Variable* CreateVariable(const std::string& name,
varname
=
string
::
Sprintf
(
"%s@%d"
,
varname
,
id
);
varname
=
string
::
Sprintf
(
"%s@%d"
,
varname
,
id
);
}
}
LOG
(
ERROR
)
<<
"creating var "
<<
varname
;
VLOG
(
3
)
<<
"creating var "
<<
varname
;
VLOG
(
3
)
<<
"creating var "
<<
varname
;
framework
::
Variable
*
var
=
scope
->
Var
(
varname
);
framework
::
Variable
*
var
=
scope
->
Var
(
varname
);
framework
::
LoDTensor
*
tensor
=
var
->
GetMutable
<
framework
::
LoDTensor
>
();
framework
::
LoDTensor
*
tensor
=
var
->
GetMutable
<
framework
::
LoDTensor
>
();
...
@@ -183,8 +182,6 @@ std::vector<Variable*> OpBase::ApplyGrad(framework::Scope* scope) {
...
@@ -183,8 +182,6 @@ std::vector<Variable*> OpBase::ApplyGrad(framework::Scope* scope) {
<<
framework
::
vectorize
(
var
->
Get
<
framework
::
LoDTensor
>
().
dims
()).
size
();
<<
framework
::
vectorize
(
var
->
Get
<
framework
::
LoDTensor
>
().
dims
()).
size
();
}
}
LOG
(
ERROR
)
<<
"grad_op_desc_"
<<
grad_op_desc_
->
Proto
()
->
DebugString
();
for
(
const
std
::
string
&
outvar
:
grad_op_desc_
->
OutputArgumentNames
())
{
for
(
const
std
::
string
&
outvar
:
grad_op_desc_
->
OutputArgumentNames
())
{
VLOG
(
3
)
<<
"op grad output var "
<<
outvar
;
VLOG
(
3
)
<<
"op grad output var "
<<
outvar
;
block_
->
FindRecursiveOrCreateVar
(
outvar
);
block_
->
FindRecursiveOrCreateVar
(
outvar
);
...
@@ -194,8 +191,6 @@ std::vector<Variable*> OpBase::ApplyGrad(framework::Scope* scope) {
...
@@ -194,8 +191,6 @@ std::vector<Variable*> OpBase::ApplyGrad(framework::Scope* scope) {
framework
::
VarDesc
*
var_desc
=
block_
->
FindVar
(
outvar
);
framework
::
VarDesc
*
var_desc
=
block_
->
FindVar
(
outvar
);
if
(
var_desc
->
GetType
()
==
framework
::
proto
::
VarType
::
LOD_TENSOR
)
{
if
(
var_desc
->
GetType
()
==
framework
::
proto
::
VarType
::
LOD_TENSOR
)
{
var
->
GetMutable
<
framework
::
LoDTensor
>
();
var
->
GetMutable
<
framework
::
LoDTensor
>
();
// framework::Tensor* tensor = var->GetMutable<framework::LoDTensor>();
// tensor->mutable_data(platform::CPUPlace());
}
else
{
}
else
{
LOG
(
ERROR
)
<<
"tracer doesn't support yet"
;
LOG
(
ERROR
)
<<
"tracer doesn't support yet"
;
}
}
...
...
paddle/fluid/operators/cross_entropy_op.h
浏览文件 @
9e24fa3a
...
@@ -110,8 +110,6 @@ class CrossEntropyGradientOpKernel : public framework::OpKernel<T> {
...
@@ -110,8 +110,6 @@ class CrossEntropyGradientOpKernel : public framework::OpKernel<T> {
auto
*
dy
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Y"
));
auto
*
dy
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Y"
));
auto
*
label
=
ctx
.
Input
<
Tensor
>
(
"Label"
);
auto
*
label
=
ctx
.
Input
<
Tensor
>
(
"Label"
);
auto
*
dx
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"X"
));
auto
*
dx
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"X"
));
LOG
(
ERROR
)
<<
"CROSS ENTROPY GRAD DX: "
<<
ctx
.
op
().
Output
(
framework
::
GradVarName
(
"X"
));
T
*
dx_data
=
dx
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
T
*
dx_data
=
dx
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
// Following computation only depends on the last dimension size. So it's
// Following computation only depends on the last dimension size. So it's
...
...
python/paddle/fluid/framework.py
浏览文件 @
9e24fa3a
...
@@ -1281,8 +1281,6 @@ class Block(object):
...
@@ -1281,8 +1281,6 @@ class Block(object):
"""
"""
op_desc
=
self
.
desc
.
append_op
()
op_desc
=
self
.
desc
.
append_op
()
op
=
Operator
(
block
=
self
,
desc
=
op_desc
,
*
args
,
**
kwargs
)
op
=
Operator
(
block
=
self
,
desc
=
op_desc
,
*
args
,
**
kwargs
)
print
(
"append_op"
,
kwargs
.
get
(
"type"
),
kwargs
.
get
(
"stop_gradient"
,
False
))
if
_in_imperative_mode
():
if
_in_imperative_mode
():
_imperative_tracer
().
trace
(
op
.
iop
,
[
v
.
_ivar
for
v
in
op
.
inputs
],
_imperative_tracer
().
trace
(
op
.
iop
,
[
v
.
_ivar
for
v
in
op
.
inputs
],
[
v
.
_ivar
for
v
in
op
.
outputs
],
self
.
desc
,
[
v
.
_ivar
for
v
in
op
.
outputs
],
self
.
desc
,
...
@@ -1336,8 +1334,6 @@ class Block(object):
...
@@ -1336,8 +1334,6 @@ class Block(object):
def
_prepend_op
(
self
,
*
args
,
**
kwargs
):
def
_prepend_op
(
self
,
*
args
,
**
kwargs
):
op_desc
=
self
.
desc
.
_prepend_op
()
op_desc
=
self
.
desc
.
_prepend_op
()
op
=
Operator
(
self
,
op_desc
,
*
args
,
**
kwargs
)
op
=
Operator
(
self
,
op_desc
,
*
args
,
**
kwargs
)
print
(
"prepend_op"
,
kwargs
.
get
(
"type"
),
kwargs
.
get
(
"stop_gradient"
,
False
))
if
_in_imperative_mode
():
if
_in_imperative_mode
():
_imperative_tracer
().
trace
(
op
.
iop
,
[
v
.
_ivar
for
v
in
op
.
inputs
],
_imperative_tracer
().
trace
(
op
.
iop
,
[
v
.
_ivar
for
v
in
op
.
inputs
],
[
v
.
_ivar
for
v
in
op
.
outputs
],
self
.
desc
,
[
v
.
_ivar
for
v
in
op
.
outputs
],
self
.
desc
,
...
...
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
浏览文件 @
9e24fa3a
...
@@ -115,9 +115,7 @@ class TestImperativeMnist(unittest.TestCase):
...
@@ -115,9 +115,7 @@ class TestImperativeMnist(unittest.TestCase):
label
.
_stop_gradient
=
True
label
.
_stop_gradient
=
True
predict
=
mnist
(
img
)
predict
=
mnist
(
img
)
print
(
predict
.
shape
,
predict
.
dtype
,
label
.
shape
,
label
.
dtype
)
out
=
fluid
.
layers
.
cross_entropy
(
predict
,
label
)
out
=
fluid
.
layers
.
cross_entropy
(
predict
,
label
)
print
(
out
.
shape
,
out
.
dtype
)
out
.
_backward
()
out
.
_backward
()
filter_grad
=
mnist
.
_simple_img_conv_pool_1
.
_conv2d
.
_filter_param
.
_gradient
(
filter_grad
=
mnist
.
_simple_img_conv_pool_1
.
_conv2d
.
_filter_param
.
_gradient
(
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录