Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
杨迪
NiuTrans.Tensor
Commits
48bdcb49
Commit
48bdcb49
authored
Mar 07, 2020
by
liyinqiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixed and clean codes.
1. Backward bugs fixed. 2. Fix the minor errors.
parent
ca1f1843
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
27 行增加
和
15 行删除
+27
-15
source/network/XBackwardFunc.cpp
+8
-1
source/network/XBackwardShape.cpp
+17
-12
source/network/XBackwardShape.h
+1
-1
source/tensor/function/LogSoftmax.cpp
+1
-1
没有找到文件。
source/network/XBackwardFunc.cpp
查看文件 @
48bdcb49
...
...
@@ -34,7 +34,14 @@ void XFuncGrad::MakeGrad(XTensor * node, bool isEfficient)
XLink
&
income
=
node
->
income
;
int
operID
=
income
.
typeID
;
CheckNTErrors
(
node
->
grad
!=
NULL
,
"No gradient found!"
);
if
(
!
isEfficient
){
CheckNTErrors
(
node
->
grad
!=
NULL
,
"No gradient found!"
);
}
else
{
CheckNTErrors
(
!
node
->
isGrad
||
node
->
grad
!=
NULL
,
"No gradient found!"
);
}
//CheckNTErrors(node->grad != NULL, "No gradient found!");
CheckNTErrors
(
income
.
tailNum
==
1
,
"Too many input tensors for the function!"
);
XTensor
*
input
=
income
.
tails
[
0
];
...
...
source/network/XBackwardShape.cpp
查看文件 @
48bdcb49
...
...
@@ -32,33 +32,38 @@
namespace
nts
{
/* compute dE/dx of a node */
void
XShapeGrad
::
MakeGrad
(
XTensor
*
node
,
bool
isEfficent
)
void
XShapeGrad
::
MakeGrad
(
XTensor
*
node
,
bool
isEffic
i
ent
)
{
CheckNTErrors
(
node
->
grad
!=
NULL
,
"No gradient found!"
);
if
(
!
isEfficient
){
CheckNTErrors
(
node
->
grad
!=
NULL
,
"No gradient found!"
);
}
else
{
CheckNTErrors
(
!
node
->
isGrad
||
node
->
grad
!=
NULL
,
"No gradient found!"
);
}
XLink
&
income
=
node
->
income
;
int
operID
=
income
.
typeID
;
if
(
operID
==
MOVEMENT_COPYINDEXED
)
GradCopyIndexed
(
node
,
isEfficent
);
GradCopyIndexed
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
MOVEMENT_GATHER
)
GradGather
(
node
,
isEfficent
);
GradGather
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
MOVEMENT_DROPOUTWITHINDEX
)
GradDropoutWithIndex
(
node
,
isEfficent
);
GradDropoutWithIndex
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_MERGE
)
GradMerge
(
node
,
isEfficent
);
GradMerge
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_MERGE_LIST
)
GradMergeList
(
node
,
isEfficent
);
GradMergeList
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_RESHAPE
)
GradReshape
(
node
,
isEfficent
);
GradReshape
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_SPLIT
)
GradSplit
(
node
,
isEfficent
);
GradSplit
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_SPLIT_LIST
)
GradSplitList
(
node
,
isEfficent
);
GradSplitList
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_TRANSPOSE
)
GradTranspose
(
node
,
isEfficent
);
GradTranspose
(
node
,
isEffic
i
ent
);
else
if
(
operID
==
SHAPE_UNSQUEEZE
)
GradUnsqueeze
(
node
,
isEfficent
);
GradUnsqueeze
(
node
,
isEffic
i
ent
);
else
{
ShowNTErrors
(
"TODO!"
);
}
...
...
source/network/XBackwardShape.h
查看文件 @
48bdcb49
...
...
@@ -34,7 +34,7 @@ class XShapeGrad
public
:
/* compute dE/dx of a node */
static
void
MakeGrad
(
XTensor
*
node
,
bool
isEfficent
);
void
MakeGrad
(
XTensor
*
node
,
bool
isEffic
i
ent
);
/* indicates whether the node is for a shaping operation */
static
...
...
source/tensor/function/LogSoftmax.cpp
查看文件 @
48bdcb49
...
...
@@ -293,7 +293,7 @@ void _LogSoftmaxBackward(XTensor * gold, XTensor * y, XTensor * x,
LOSS_FUNCTION_NAME
lossName
)
{
CheckNTErrors
((
!
dedx
->
isSparse
),
"The gradient matrix must be dense!"
);
CheckNTErrors
((
gold
!=
NULL
),
"The gold standard cannot be empty!"
);
CheckNTErrors
((
gold
!=
NULL
||
lossName
==
NOLOSS
),
"The gold standard cannot be empty!"
);
if
(
leadDim
<
0
)
leadDim
=
y
->
order
-
1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论