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
bd05b21b
Commit
bd05b21b
authored
Feb 18, 2020
by
xuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the bug and add the function CheckDataType
parent
6c15668f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
19 行增加
和
9 行删除
+19
-9
source/Main.cpp
+7
-7
source/tensor/XCall.cpp
+1
-1
source/tensor/XDataType.h
+10
-0
source/tensor/XMem.cpp
+1
-1
没有找到文件。
source/
network/
Main.cpp
→
source/Main.cpp
查看文件 @
bd05b21b
...
...
@@ -20,13 +20,13 @@
*/
#include <stdio.h>
#include "XNet.h"
#include ".
.
/tensor/XUtility.h"
#include ".
.
/tensor/function/FHeader.h"
#include ".
.
/tensor/core/CHeader.h"
#include ".
.
/tensor/test/Test.h"
#include ".
.
/sample/fnnlm/FNNLM.h"
#include ".
.
/sample/transformer/Transformer.h"
#include "
./network/
XNet.h"
#include "./tensor/XUtility.h"
#include "./tensor/function/FHeader.h"
#include "./tensor/core/CHeader.h"
#include "./tensor/test/Test.h"
#include "./sample/fnnlm/FNNLM.h"
#include "./sample/transformer/Transformer.h"
//#define CRTDBG_MAP_ALLOC
//#include <stdlib.h>
...
...
source/tensor/XCall.cpp
查看文件 @
bd05b21b
...
...
@@ -778,7 +778,7 @@ XTensor * NewTensor5D(const int d0, const int d1, const int d2, const int d3, co
XTensor
*
NewTensorRange
(
int
lower
,
int
upper
,
int
step
,
const
TENSOR_DATA_TYPE
myDataType
,
const
int
myDevID
,
const
bool
isEnableGrad
)
{
int
size
=
abs
(
upper
-
lower
);
int
unitNum
=
ceil
(
1.0
*
size
/
abs
(
step
));
int
unitNum
=
(
int
)
ceil
(
1.0
*
size
/
abs
(
step
));
XTensor
*
tensor
=
NewTensor1D
(
unitNum
,
myDataType
,
myDevID
,
isEnableGrad
);
tensor
->
Range
(
lower
,
upper
,
step
);
...
...
source/tensor/XDataType.h
查看文件 @
bd05b21b
...
...
@@ -49,6 +49,15 @@ extern TENSOR_DATA_TYPE GetDataType(const char * typeName);
unsigned
short
FloatToFloat16
(
float
f
);
float
Float16ToFloat
(
unsigned
short
h
);
#define CheckDataType(a, b) \
{ \
if(GetDataTypeName(a) != GetDataTypeName(a)){ \
fprintf(stderr, "[ERROR] (%s line %d): we must run the code on the same datatype (%s vs %s)\n", \
__FILENAME__, __LINE__, GetDataTypeName(a), GetDataTypeName(b)); \
exit(1); \
} \
} \
}
/* end of the nts (NiuTrans.Tensor) namespace */
#endif
\ No newline at end of file
source/tensor/XMem.cpp
查看文件 @
bd05b21b
...
...
@@ -1482,7 +1482,7 @@ void XMem::ShowMemUsage(FILE * file)
}
fprintf
(
file
,
"mem:%.1fMB used:%.1fMB usage:%.3f
\n
"
,
(
DTYPE
)
used
/
MILLION
,
(
DTYPE
)
total
/
MILLION
,
(
DTYPE
)
used
/
total
);
(
DTYPE
)
total
/
MILLION
,
(
DTYPE
)
used
/
MILLION
,
(
DTYPE
)
used
/
total
);
}
#ifdef USE_CUDA
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论