Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
8
Issues
8
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
NiuTrans.Tensor
Commits
450872fc
Commit
450872fc
authored
Mar 13, 2021
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes
parent
e31eed94
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
32 行增加
和
9 行删除
+32
-9
source/Main.cpp
+5
-2
source/network/XNet.cpp
+15
-2
source/train/TTrain.cpp
+10
-3
source/train/XTrainer.cpp
+1
-1
source/train/XWorkerCollect.cpp
+1
-1
没有找到文件。
source/Main.cpp
查看文件 @
450872fc
...
...
@@ -40,8 +40,11 @@ using namespace nmt;
int
main
(
int
argc
,
const
char
**
argv
)
{
XConfig
config
;
config
.
Create
(
argc
-
1
,
argv
+
1
);
verboseLevel
=
config
.
GetInt
(
"verbose"
,
1
);
if
(
argc
>
1
){
config
.
Create
(
argc
-
1
,
argv
+
1
);
verboseLevel
=
config
.
GetInt
(
"verbose"
,
1
);
}
if
(
argc
>
1
&&
!
strcmp
(
argv
[
1
],
"-test"
))
Test
();
...
...
source/network/XNet.cpp
查看文件 @
450872fc
...
...
@@ -109,7 +109,7 @@ void XNet::Backward(TensorList &roots)
XTensor
*
node
=
(
XTensor
*
)
nodes
.
Get
(
i
);
if
(
node
->
mem
!=
NULL
){
CheckNTErrors
(
node
->
mem
->
bufUsed
<
BUF_PITCH
,
"Illegal access of buffer!"
);
//
CheckNTErrors(node->mem->bufUsed < BUF_PITCH, "Illegal access of buffer!");
}
if
(
node
->
visitMark
!=
NODE_FINISHED
)
...
...
@@ -128,7 +128,20 @@ void XNet::Backward(TensorList &roots)
delete
node
;
}
}
}
}
for
(
int
i
=
0
;
i
<
nodes
.
count
;
i
++
)
{
XTensor
*
node
=
(
XTensor
*
)
nodes
.
Get
(
i
);
if
(
node
->
income
.
tailNum
>=
100
||
node
->
outgo
.
tailNum
>=
100
)
{
XPRINT
(
1
,
stderr
,
"Are you sure that the node should connect so many (100) nodes?
\n
"
);
}
if
(
node
->
grad
!=
NULL
)
{
XTensor
*
grad
=
node
->
grad
;
if
(
grad
->
income
.
tailNum
>=
100
||
grad
->
outgo
.
tailNum
>=
100
)
{
XPRINT
(
1
,
stderr
,
"Are you sure that the grad node should connect so many (100) nodes?
\n
"
);
}
}
}
}
...
...
source/train/TTrain.cpp
查看文件 @
450872fc
...
...
@@ -76,12 +76,15 @@ void TestTrain()
GeneateTTrainData
(
"ttrain.txt"
);
XConfig
config
;
config
.
Add
(
"dev"
,
-
1
);
//
config.Add("dev", -1);
config
.
Add
(
"lrate"
,
0.001
F
);
config
.
Add
(
"nstep"
,
10000
);
config
.
Add
(
"nstep"
,
10000
0
);
config
.
Add
(
"nepoch"
,
5
);
//
config.Add("jobdev0", -1);
config
.
Add
(
"jobdev0"
,
-
1
);
//config.Add("jobdev1", -1);
//config.Add("jobdev2", -1);
//config.Add("jobdev3", -1);
//config.Add("jobdev4", -1);
TTDataLoader
loader
;
loader
.
SetFileName
(
"ttrain.txt"
);
...
...
@@ -300,6 +303,10 @@ XModel * TTModel::Clone(int devID)
model
->
SetConfig
(
config
);
model
->
Init
(
config
,
devID
);
CopyValues
(
embeddingW
,
model
->
embeddingW
);
CopyValues
(
hiddenW
,
model
->
hiddenW
);
CopyValues
(
outputW
,
model
->
outputW
);
return
model
;
}
...
...
source/train/XTrainer.cpp
查看文件 @
450872fc
...
...
@@ -135,7 +135,7 @@ void XTrainer::Run(XConfig * config, DataDistributeBase * dataDistributor,
XPRINT5
(
1
,
stderr
,
"[INFO] elapsed=%.1fs epoch:%d step:%d sample:%d loss:%f
\n
"
,
GetClockSec
()
-
startT
,
epoch
+
1
,
step
+
1
,
leader
.
GetSampleNum
(),
loss
);
if
(
step
++
>=
optimizer
->
nstep
)
if
(
++
step
>=
optimizer
->
nstep
)
break
;
}
...
...
source/train/XWorkerCollect.cpp
查看文件 @
450872fc
...
...
@@ -196,7 +196,7 @@ void XWorkerCollect::CollectP2P(XTensor * source, XTensor * target)
/* target += source */
if
(
source
!=
target
)
Sum
(
*
source
,
*
target
,
*
source
);
_Sum
(
source
,
target
,
source
);
}
/*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论