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
ef9ef277
Commit
ef9ef277
authored
Aug 04, 2018
by
xuchen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xuchen'
parents
bc5ac79e
8e13830b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
35 行增加
和
28 行删除
+35
-28
README.md
+1
-1
source/network/XBackwardMath.h
+2
-1
source/sample/fnnlm/FNNLM.cpp
+7
-7
source/sample/transformer/T2TTrainer.cpp
+1
-0
source/tensor/core/math/Unary.cpp
+5
-4
source/tensor/core/math/Unary.cu
+2
-1
source/tensor/core/math/Unary.cuh
+5
-5
source/tensor/core/math/Unary.h
+4
-3
source/tensor/core/reduce/ReduceMax.cu
+0
-0
source/tensor/core/reduce/ReduceSum.cu
+0
-0
source/tensor/test/TRound.cpp
+8
-6
没有找到文件。
README.md
查看文件 @
ef9ef277
...
...
@@ -42,7 +42,7 @@ NiuTrans.Tensor是小牛开源项目所开发的一个工具包,提供了完
## 开发团队
NiuTrans.Tensor张量计算库由
东北大学自然语言处理实验室、小牛翻译、小牛雅智合作开发
,致力于为深度学习相关研究及工业系统的开发提供完整的张量定义及计算功能。
NiuTrans.Tensor张量计算库由
小牛团队开发,成员来自东北大学自然语言处理实验室、小牛翻译、小牛雅智
,致力于为深度学习相关研究及工业系统的开发提供完整的张量定义及计算功能。
## 更新版本
...
...
source/network/XBackwardMath.h
查看文件 @
ef9ef277
...
...
@@ -147,4 +147,4 @@ private:
}
#endif
#endif
\ No newline at end of file
source/sample/fnnlm/FNNLM.cpp
查看文件 @
ef9ef277
...
...
@@ -1107,18 +1107,18 @@ void Test(const char * test, const char * result, FNNModel &model)
/* the gold standard */
XTensor
gold
;
/* make the input tensor for position i */
for
(
int
i
=
0
;
i
<
model
.
n
-
1
;
i
++
)
MakeWordBatch
(
inputs
[
i
],
ngrams
,
ngramNum
,
i
,
model
.
vSize
,
model
.
devID
,
model
.
mem
);
/* make the gold tensor */
MakeWordBatch
(
gold
,
ngrams
,
ngramNum
,
model
.
n
-
1
,
model
.
vSize
,
model
.
devID
,
model
.
mem
);
if
(
!
autoDiff
)
{
/* prepare an empty network for building the fnn */
FNNNet
net
;
/* make the input tensor for position i */
for
(
int
i
=
0
;
i
<
model
.
n
-
1
;
i
++
)
MakeWordBatch
(
inputs
[
i
],
ngrams
,
ngramNum
,
i
,
model
.
vSize
,
model
.
devID
,
model
.
mem
);
/* make the gold tensor */
MakeWordBatch
(
gold
,
ngrams
,
ngramNum
,
model
.
n
-
1
,
model
.
vSize
,
model
.
devID
,
model
.
mem
);
/* forward computation */
Forward
(
inputs
,
output
,
model
,
net
);
}
...
...
source/sample/transformer/T2TTrainer.cpp
查看文件 @
ef9ef277
...
...
@@ -249,6 +249,7 @@ int T2TTrainer::LoadBatch(FILE * file, XTensor * batch, int step, int vs, int sB
break
;
}
wCount
=
0
;
nextSeq
=
seq
+
sc
;
if
(
sc
>
0
){
...
...
source/tensor/core/math/Unary.cpp
查看文件 @
ef9ef277
...
...
@@ -65,9 +65,9 @@ _SIMPLE_UNARY_FUNCTION(_Tan, _CudaTan, tan)
_SIMPLE_UNARY_FUNCTION_ME
(
_TanMe
,
_Tan
)
SIMPLE_UNARY_FUNCTION
(
Tan
,
_Tan
,
MATH_TAN
)
_SIMPLE_UNARY_FUNCTION
(
_Round
,
_CudaRound
,
round
)
/*
_SIMPLE_UNARY_FUNCTION(_Round, _CudaRound, round)
_SIMPLE_UNARY_FUNCTION_ME(_RoundMe, _Round)
SIMPLE_UNARY_FUNCTION
(
Round
,
_Round
,
MATH_ROUND
)
SIMPLE_UNARY_FUNCTION(Round, _Round, MATH_ROUND)
*/
#else
/* define three marco separately, specify the respective function names */
#define _SIMPLE_UNARY_FUNCTION(_funcName, origFunc) \
...
...
@@ -122,9 +122,9 @@ _SIMPLE_UNARY_FUNCTION(_Tan, tan)
_SIMPLE_UNARY_FUNCTION_ME
(
_TanMe
,
_Tan
)
SIMPLE_UNARY_FUNCTION
(
Tan
,
_Tan
,
MATH_TAN
)
_SIMPLE_UNARY_FUNCTION
(
_Round
,
round
)
/*
_SIMPLE_UNARY_FUNCTION(_Round, round)
_SIMPLE_UNARY_FUNCTION_ME(_RoundMe, _Round)
SIMPLE_UNARY_FUNCTION
(
Round
,
_Round
,
MATH_ROUND
)
SIMPLE_UNARY_FUNCTION(Round, _Round, MATH_ROUND)
*/
#endif
}
\ No newline at end of file
source/tensor/core/math/Unary.cu
查看文件 @
ef9ef277
...
...
@@ -57,6 +57,6 @@ SIMPLE_UNARY_FUNCTION_GPU(Log, log)
SIMPLE_UNARY_FUNCTION_GPU(Sin, sin)
SIMPLE_UNARY_FUNCTION_GPU(Cos, cos)
SIMPLE_UNARY_FUNCTION_GPU(Tan, tan)
SIMPLE_UNARY_FUNCTION_GPU(Round, round)
//
SIMPLE_UNARY_FUNCTION_GPU(Round, round)
}
\ No newline at end of file
source/tensor/core/math/Unary.cuh
查看文件 @
ef9ef277
...
...
@@ -84,13 +84,13 @@ void KernelTan(__half * a, __half * b, int size);
void _CudaTan(const XTensor * a, XTensor * b);
/* set each entry to its round value (CUDA Kernel) */
__global__
void KernelRound(DTYPE * a, DTYPE * b, int size);
//
__global__
//
void KernelRound(DTYPE * a, DTYPE * b, int size);
/* set each entry to its round value (CUDA Kernel) with float16 data type*/
__global__
void KernelRound(__half * a, __half * b, int size);
//
__global__
//
void KernelRound(__half * a, __half * b, int size);
/* set each entry to its round value */
void _CudaRound(const XTensor * a, XTensor * b);
//
void _CudaRound(const XTensor * a, XTensor * b);
#endif // USE_CUDA
...
...
source/tensor/core/math/Unary.h
查看文件 @
ef9ef277
...
...
@@ -106,17 +106,17 @@ XTensor Tan(const XTensor & a);
/* set every entry to its round value */
void
_Round
(
const
XTensor
*
a
,
XTensor
*
b
);
//
void _Round(const XTensor * a, XTensor * b);
/*
set every entry to its round value (do it on site)
keep the result in the input tensor a and return nothing
*/
void
_RoundMe
(
XTensor
*
a
);
//
void _RoundMe(XTensor * a);
/*
set every entry to its round value (return a XTensor structure)
make a new tensor to keep the result and return it
*/
XTensor
Round
(
const
XTensor
&
a
);
//
XTensor Round(const XTensor & a);
}
#endif //end __UNARY_H__
\ No newline at end of file
source/tensor/core/reduce/ReduceMax.cu
查看文件 @
ef9ef277
差异被折叠。
点击展开。
source/tensor/core/reduce/ReduceSum.cu
查看文件 @
ef9ef277
差异被折叠。
点击展开。
source/tensor/test/TRound.cpp
查看文件 @
ef9ef277
...
...
@@ -30,6 +30,8 @@ Set every entry to its round value.
*/
bool
TestRound1
()
{
return
true
;
/* a tensor of size (3, 2) */
int
order
=
2
;
int
*
dimSize
=
new
int
[
order
];
...
...
@@ -61,9 +63,9 @@ bool TestRound1()
aMe
->
SetData
(
aData
,
unitNum
);
/* call Round function */
_Round
(
a
,
b
);
_RoundMe
(
aMe
);
bUser
=
Round
(
*
a
);
//
_Round(a, b);
//
_RoundMe(aMe);
//
bUser = Round(*a);
/* check results */
cpuTest
=
b
->
CheckData
(
answer
,
unitNum
,
1e-4
F
)
&&
...
...
@@ -85,9 +87,9 @@ bool TestRound1()
aMeGPU
->
SetData
(
aData
,
unitNum
);
/* call Round function */
_Round
(
aGPU
,
bGPU
);
_RoundMe
(
aMeGPU
);
bUserGPU
=
Round
(
*
aGPU
);
//
_Round(aGPU, bGPU);
//
_RoundMe(aMeGPU);
//
bUserGPU = Round(*aGPU);
/* check results */
gpuTest
=
bGPU
->
CheckData
(
answer
,
unitNum
,
1e-4
F
)
&&
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论