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
1f5627f9
Commit
1f5627f9
authored
Jun 29, 2019
by
huchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor XList: now a list has the same basic function as a STL vector
parent
72c9551b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
18 行增加
和
15 行删除
+18
-15
source/sample/main.cpp
+3
-0
source/tensor/XList.h
+0
-0
source/tensor/core/arithmetic/MatrixMul2DMultiTheading.cpp
+4
-4
source/tensor/core/shape/Merge.cpp
+7
-7
source/tensor/core/utilities/XMatrixSegment.cpp
+4
-4
没有找到文件。
source/sample/main.cpp
查看文件 @
1f5627f9
...
...
@@ -53,6 +53,9 @@ void TestDataManager() {
s
[
9
]
=
0
;
str
.
Add
(
s
);
cout
<<
str
.
Get
(
0
);
vector
<
int
>
x
;
}
int
main
()
...
...
source/tensor/XList.h
查看文件 @
1f5627f9
差异被折叠。
点击展开。
source/tensor/core/arithmetic/MatrixMul2DMultiTheading.cpp
查看文件 @
1f5627f9
...
...
@@ -51,10 +51,10 @@ void _MatrixMul2DMultiTheading(XList * args)
XTensor
*
c
=
matrixArgs
->
GetItem
(
2
);
DTYPE
alpha
=
*
(
DTYPE
*
)(
matrixArgs
->
GetItem
(
3
));
DTYPE
beta
=
*
(
DTYPE
*
)(
matrixArgs
->
GetItem
(
4
));
int
x1
=
*
(
indexArgs
->
GetItem
(
0
)
);
int
y1
=
*
(
indexArgs
->
GetItem
(
1
)
);
int
x2
=
*
(
indexArgs
->
GetItem
(
2
)
);
int
y2
=
*
(
indexArgs
->
GetItem
(
3
)
);
int
x1
=
indexArgs
->
GetItem
(
0
);
int
y1
=
indexArgs
->
GetItem
(
1
);
int
x2
=
indexArgs
->
GetItem
(
2
);
int
y2
=
indexArgs
->
GetItem
(
3
);
#ifdef FAST_MATRIX
int
am
=
a
->
dimSize
[
1
];
...
...
source/tensor/core/shape/Merge.cpp
查看文件 @
1f5627f9
...
...
@@ -217,15 +217,15 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
bool
uniform
=
true
;
int
mergeNum
=
smalls
->
count
;
XTensor
*
smallsItem0
=
(
XTensor
*
)(
smalls
->
GetItem
(
0
)
);
XTensor
*
smallsItem0
=
smalls
->
GetItem
(
0
);
int
itemSize
=
smallsItem0
->
unitNum
*
smallsItem0
->
unitSize
;
for
(
int
i
=
0
;
i
<
smalls
->
count
;
i
++
)
{
XTensor
*
smallsItem
=
(
XTensor
*
)
smalls
->
GetItem
(
i
);
XTensor
*
smallsItem
=
smalls
->
GetItem
(
i
);
CheckNTErrors
((
big
->
unitNum
==
smallsItem
->
unitNum
*
mergeNum
),
"Unmatched tensors!"
);
if
(
i
>
0
)
{
XTensor
*
preItem
=
(
XTensor
*
)
smalls
->
GetItem
(
i
-
1
);
XTensor
*
preItem
=
smalls
->
GetItem
(
i
-
1
);
if
(
smallsItem
->
unitNum
*
smallsItem
->
unitSize
!=
(
char
*
)
smallsItem
->
data
-
(
char
*
)
preItem
->
data
)
uniform
=
false
;
}
...
...
@@ -237,7 +237,7 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
int
gridNum
=
1
;
int
mergedNum
=
smalls
->
count
;
XTensor
*
s0
=
(
XTensor
*
)
smalls
->
GetItem
(
0
);
XTensor
*
s0
=
smalls
->
GetItem
(
0
);
int
whereToMergeRDI
=
s0
->
order
-
whereToMerge
-
1
;
for
(
int
i
=
0
;
i
<
s0
->
order
;
i
++
)
{
if
(
i
<=
whereToMergeRDI
)
...
...
@@ -263,7 +263,7 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
for
(
int
g
=
0
;
g
<
gridNum
;
g
++
)
{
char
*
tData
=
(
char
*
)
big
->
data
+
g
*
blockSize
*
blockNum
*
big
->
unitSize
;
for
(
int
k
=
0
;
k
<
mergedNum
;
k
++
)
{
XTensor
*
s
=
(
XTensor
*
)
smalls
->
GetItem
(
k
);
XTensor
*
s
=
smalls
->
GetItem
(
k
);
char
*
sData
=
(
char
*
)
s
->
data
+
g
*
blockSize
*
blockNum
*
s
->
unitSize
;
XMemCopy2D
(
tData
+
k
*
tStep
,
tPtich
,
big
->
devID
,
sData
+
k
*
sStep
,
sPitch
,
s
->
devID
,
...
...
@@ -295,7 +295,7 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
/* copy from source to tmp */
if
(
!
uniform
)
{
for
(
int
i
=
0
;
i
<
mergeNum
;
i
++
)
{
XTensor
*
smallsItem
=
(
XTensor
*
)
smalls
->
GetItem
(
i
);
XTensor
*
smallsItem
=
smalls
->
GetItem
(
i
);
XMemCopy
((
char
*
)(
tensorTMP
->
data
)
+
(
itemSize
*
i
),
tensorTMP
->
devID
,
smallsItem
->
data
,
smallsItem
->
devID
,
itemSize
);
}
}
...
...
@@ -324,7 +324,7 @@ make a new tensor to keep the result and return it
*/
XTensor
Merge
(
const
XList
&
smalls
,
int
whereToMerge
)
{
XTensor
*
tensor
=
(
XTensor
*
)
smalls
.
GetItem
(
0
);
XTensor
*
tensor
=
smalls
.
GetItem
(
0
);
int
order
=
tensor
->
order
;
int
*
dimSize
=
new
int
[
order
];
for
(
int
i
=
0
;
i
<
tensor
->
order
;
i
++
)
{
...
...
source/tensor/core/utilities/XMatrixSegment.cpp
查看文件 @
1f5627f9
...
...
@@ -81,10 +81,10 @@ void RunParallel2D(XPRunner * parallelRunner, void * job,
XList
*
blockArgs
=
new
XList
(
argNum
);
int
*
blockIndex
=
indexList
+
i
*
4
;
indexArgs
->
Add
(
blockIndex
);
indexArgs
->
Add
(
blockIndex
+
1
);
indexArgs
->
Add
(
blockIndex
+
2
);
indexArgs
->
Add
(
blockIndex
+
3
);
indexArgs
->
Add
(
blockIndex
[
0
]
);
indexArgs
->
Add
(
blockIndex
[
1
]
);
indexArgs
->
Add
(
blockIndex
[
2
]
);
indexArgs
->
Add
(
blockIndex
[
3
]
);
for
(
int
j
=
0
;
j
<
argNum
;
j
++
)
blockArgs
->
Add
(
jobArgList
->
GetItem
(
j
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论