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
Emmay
NiuTrans.Tensor
Commits
8cb65ef5
Commit
8cb65ef5
authored
Mar 13, 2019
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean the code
parent
d2011ab6
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
5 行增加
和
10 行删除
+5
-10
source/network/XBackwardMath.cpp
+1
-2
source/sample/transformer/T2TTrainer.cpp
+0
-4
source/sample/transformer/Transformer.cpp
+1
-0
source/tensor/core/getandset/OnehotAndIndex.cpp
+1
-2
source/tensor/core/reduce/ReduceSumAll.cpp
+2
-2
没有找到文件。
source/network/XBackwardMath.cpp
查看文件 @
8cb65ef5
...
...
@@ -843,7 +843,6 @@ void XMathGrad::GradMultiplyBroadcast(XTensor * node, bool isEfficient)
XTensor
*
a
=
income
.
tails
[
0
];
XTensor
*
b
=
income
.
tails
[
1
];
DTYPE
beta
=
income
.
GetParam
(
0
);
XNoder
::
MakeGrad
(
a
);
_MultiplyBroadcast
(
node
->
grad
,
b
,
a
->
grad
,
1.0
F
);
...
...
@@ -1311,7 +1310,7 @@ void XMathGrad::GradSumBroadcast(XTensor * node, bool isEfficient)
XTensor
*
a
=
income
.
tails
[
0
];
XTensor
*
b
=
income
.
tails
[
1
];
DTYPE
beta
=
income
.
GetParam
(
0
);
//
DTYPE beta = income.GetParam(0);
XNoder
::
MakeGrad
(
a
);
_Sum
(
a
->
grad
,
node
->
grad
,
a
->
grad
);
...
...
source/sample/transformer/T2TTrainer.cpp
查看文件 @
8cb65ef5
...
...
@@ -150,7 +150,6 @@ void T2TTrainer::Train(const char * fn, const char * validFN, const char * model
int
wc
=
0
;
int
ws
=
0
;
int
wordCount
=
0
;
int
totalW
;
int
wordCountTotal
=
0
;
int
wordCountBatch
=
0
;
bool
isEnd
=
false
;
...
...
@@ -590,7 +589,6 @@ int T2TTrainer::LoadBuf(FILE * file, bool isSorted, int step)
/* distribute samples into buckets. In each bucket, sequences have
similar a length */
if
(
bucketSize
>
0
)
{
int
bucketCount
=
0
;
int
low
=
0
;
int
high
=
low
+
bucketSize
;
int
n
=
count
-
1
;
...
...
@@ -947,7 +945,6 @@ int T2TTrainer::LoadBatchMT(FILE * file,
int
sCount
=
sc
/
2
;
int
seqSize
=
0
;
int
dimsDec
[
3
]
=
{
sCount
,
maxDec
,
vsDec
};
InitTensor2D
(
batchEnc
,
sCount
,
maxEnc
,
X_INT
,
devID
,
mem
);
InitTensor2D
(
paddingEnc
,
sCount
,
maxEnc
,
X_FLOAT
,
devID
,
mem
);
...
...
@@ -966,7 +963,6 @@ int T2TTrainer::LoadBatchMT(FILE * file,
int
wCountEnc
=
0
;
int
wCountDec
=
0
;
int
wCountPad
=
0
;
int
wGold
=
0
;
wCount
=
0
;
int
*
batchEncValues
=
new
int
[
batchEnc
->
unitNum
];
...
...
source/sample/transformer/Transformer.cpp
查看文件 @
8cb65ef5
...
...
@@ -25,6 +25,7 @@
#include "T2TModel.h"
#include "T2TUtility.h"
#include "T2TTrainer.h"
#include "T2TSearcher.h"
#include "../../tensor/XDevice.h"
#include "../../tensor/XUtility.h"
#include "../../tensor/XGlobal.h"
...
...
source/tensor/core/getandset/OnehotAndIndex.cpp
查看文件 @
8cb65ef5
...
...
@@ -111,10 +111,9 @@ void _IndexToOnehot(XTensor * index, XTensor * onehot, int size, float labelSmoo
onehot
->
SetZeroAll
();
#ifdef USE_CUDA
float
confidence
=
1
-
labelSmoothingP
;
float
lowconfidence
=
labelSmoothingP
/
size
;
#ifdef USE_CUDA
if
(
onehot
->
devID
>=
0
&&
index
->
devID
>=
0
)
{
_CudaIndexToOnehot
(
index
,
onehot
,
size
,
confidence
,
lowconfidence
);
return
;
...
...
source/tensor/core/reduce/ReduceSumAll.cpp
查看文件 @
8cb65ef5
...
...
@@ -62,7 +62,7 @@ DTYPE _ReduceSumAll(const XTensor * source)
return
r
;
int
order
=
source
->
order
;
/*
int order = source->order;
DTYPE summation;
XTensor * big = NewTensor(source);
...
...
@@ -90,7 +90,7 @@ DTYPE _ReduceSumAll(const XTensor * source)
summation = big->Get1D(0);
delete big;
return
summation
;
return summation;
*/
}
/*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论