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
f6fe574c
Commit
f6fe574c
authored
Jul 08, 2018
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove tensor connections
parent
9a0c89fb
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
7 行增加
和
76 行删除
+7
-76
source/core/arithmetic/MatrixMul.cpp
+0
-6
source/core/arithmetic/MatrixMul2D.cpp
+1
-8
source/core/arithmetic/MatrixMulBatched.cpp
+0
-6
source/core/arithmetic/Multiply.cpp
+1
-7
source/core/arithmetic/Sum.cpp
+1
-6
source/core/getandset/Select.cpp
+0
-6
source/core/reduce/ReduceMax.cpp
+1
-6
source/core/reduce/ReduceSum.cpp
+0
-6
source/core/shape/Merge.cpp
+0
-5
source/core/shape/Unsqueeze.cpp
+1
-7
source/core/sort/Sort.cpp
+1
-6
source/core/sort/TopK.cpp
+1
-7
没有找到文件。
source/core/arithmetic/MatrixMul.cpp
查看文件 @
f6fe574c
...
...
@@ -59,12 +59,6 @@ void MatrixMul(XTensor * a, MATRIX_TRANS_TYPE transposedA,
CheckNTErrors
((
a
->
order
>=
2
&&
b
->
order
>=
2
&&
c
->
order
>=
2
),
"Input tensors must have a order > 2!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
c
,
MATH_MATRIXMUL
);
XLink
::
AddParamToHeadInt
(
c
,
transposedA
);
XLink
::
AddParamToHeadInt
(
c
,
transposedB
);
XLink
::
AddParamToHead
(
c
,
alpha
);
XLink
::
AddParamToHead
(
c
,
beta
);
int
an
=
transposedA
==
X_TRANS
?
a
->
dimSizeRDI
[
0
]
:
a
->
dimSizeRDI
[
1
];
int
am
=
transposedA
==
X_TRANS
?
a
->
dimSizeRDI
[
1
]
:
a
->
dimSizeRDI
[
0
];
int
bn
=
transposedB
==
X_TRANS
?
b
->
dimSizeRDI
[
0
]
:
b
->
dimSizeRDI
[
1
];
...
...
source/core/arithmetic/MatrixMul2D.cpp
查看文件 @
f6fe574c
...
...
@@ -48,17 +48,10 @@ void MatrixMul2D(XTensor * a, MATRIX_TRANS_TYPE transposedA,
XPRunner
*
parallelRunner
,
XStream
*
stream
)
{
CheckNTErrors
((
a
&&
b
&&
c
),
"Empty input tensors!"
);
CheckNTErrors
((
a
->
dataType
==
b
->
dataType
),
"Input tensors should have the same data type!"
);
CheckNTErrors
((
a
->
dataType
==
b
->
dataType
),
"Input tensors should
have the same data type!"
);
CheckNTErrors
((
a
->
order
==
2
&&
b
->
order
==
2
&&
c
->
order
==
2
),
"Input tensors must have a order = 2!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
c
,
MATH_MATRIXMUL2D
);
XLink
::
AddParamToHeadInt
(
c
,
transposedA
);
XLink
::
AddParamToHeadInt
(
c
,
transposedB
);
XLink
::
AddParamToHead
(
c
,
alpha
);
XLink
::
AddParamToHead
(
c
,
beta
);
int
an
=
a
->
dimSize
[
0
],
am
=
a
->
dimSize
[
1
];
int
bn
=
b
->
dimSize
[
0
],
bm
=
b
->
dimSize
[
1
];
int
cn
=
c
->
dimSize
[
0
],
cm
=
c
->
dimSize
[
1
];
...
...
source/core/arithmetic/MatrixMulBatched.cpp
查看文件 @
f6fe574c
...
...
@@ -54,12 +54,6 @@ void MatrixMulBatched(XTensor * a, MATRIX_TRANS_TYPE transposedA,
CheckNTErrors
((
a
->
order
>=
2
&&
b
->
order
>=
2
&&
c
->
order
>=
2
),
"Input tensors must have a order > 2!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
c
,
MATH_MATRIXMULBATCHED
);
XLink
::
AddParamToHeadInt
(
c
,
transposedA
);
XLink
::
AddParamToHeadInt
(
c
,
transposedB
);
XLink
::
AddParamToHead
(
c
,
alpha
);
XLink
::
AddParamToHead
(
c
,
beta
);
int
an
=
transposedA
==
X_TRANS
?
a
->
dimSizeRDI
[
0
]
:
a
->
dimSizeRDI
[
1
];
int
am
=
transposedA
==
X_TRANS
?
a
->
dimSizeRDI
[
1
]
:
a
->
dimSizeRDI
[
0
];
int
bn
=
transposedB
==
X_TRANS
?
b
->
dimSizeRDI
[
0
]
:
b
->
dimSizeRDI
[
1
];
...
...
source/core/arithmetic/Multiply.cpp
查看文件 @
f6fe574c
...
...
@@ -43,11 +43,6 @@ void Multiply(XTensor * a, XTensor * b, XTensor * c, int leadingDim, DTYPE alpha
"Unmatched tensors in multiplication!"
);
CheckNTErrors
((
a
->
order
==
b
->
order
&&
a
->
order
==
c
->
order
),
"Unmatched tensors!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
c
,
MATH_MULTIPLY
);
XLink
::
AddParamToHeadInt
(
c
,
leadingDim
);
XLink
::
AddParamToHead
(
c
,
alpha
);
#ifdef USE_CUDA
if
(
a
->
devID
>=
0
||
b
->
devID
>=
0
||
c
->
devID
>=
0
)
{
CudaMultiply
(
a
,
b
,
c
,
leadingDim
,
alpha
);
...
...
@@ -123,4 +118,4 @@ void Multiply(XTensor * a, XTensor * b, XTensor * c, int leadingDim, DTYPE alpha
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
source/core/arithmetic/Sum.cpp
查看文件 @
f6fe574c
...
...
@@ -44,10 +44,6 @@ void Sum(XTensor * a, XTensor * b, XTensor * c, DTYPE beta)
CheckNTErrors
(
a
->
dataType
==
b
->
dataType
&&
a
->
dataType
==
c
->
dataType
,
"Unmatched tensors in addition!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
c
,
MATH_SUM
);
XLink
::
AddParamToHead
(
c
,
beta
);
if
(
a
->
devID
>=
0
||
b
->
devID
>=
0
||
c
->
devID
>=
0
)
{
#ifdef USE_CUDA
...
...
@@ -117,4 +113,4 @@ void Sum(XTensor * a, XTensor * b, XTensor * c, DTYPE beta)
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
source/core/getandset/Select.cpp
查看文件 @
f6fe574c
...
...
@@ -55,12 +55,6 @@ void SelectRange(XTensor * a, XTensor * c, int dim, int low, int high)
}
}
/* make tensor connections */
XLink
::
MakeLink
(
a
,
NULL
,
c
,
MATH_SELECTRANGE
);
XLink
::
AddParamToHeadInt
(
c
,
dim
);
XLink
::
AddParamToHeadInt
(
c
,
low
);
XLink
::
AddParamToHeadInt
(
c
,
high
);
int
stride
=
1
;
int
dimRDI
=
a
->
order
-
dim
-
1
;
for
(
int
i
=
0
;
i
<
dimRDI
;
i
++
)
...
...
source/core/reduce/ReduceMax.cpp
查看文件 @
f6fe574c
...
...
@@ -53,10 +53,6 @@ void ReduceMax(XTensor * input, XTensor * output, int dim)
}
}
/* make tensor connections */
XLink
::
MakeLink
(
input
,
NULL
,
output
,
MATH_REDUCEMAX
);
XLink
::
AddParamToHeadInt
(
output
,
dim
);
if
(
input
->
devID
>=
0
){
#ifdef USE_CUDA
CudaReduceMax
(
input
,
output
,
dim
);
...
...
@@ -94,4 +90,4 @@ void ReduceMax(XTensor * input, XTensor * output, int dim)
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
source/core/reduce/ReduceSum.cpp
查看文件 @
f6fe574c
...
...
@@ -59,12 +59,6 @@ void ReduceSum(XTensor * input, XTensor * output, int dim, XTensor * shift, DTYP
}
}
/* make tensor connections */
XLink
::
MakeLink
(
input
,
shift
,
output
,
MATH_REDUCESUM
);
XLink
::
AddParamToHeadInt
(
output
,
dim
);
XLink
::
AddParamToHead
(
output
,
power
);
XLink
::
AddParamToHeadInt
(
output
,
isExp
);
if
(
input
->
devID
>=
0
){
#ifdef USE_CUDA
CudaReduceSum
(
input
,
output
,
dim
,
shift
,
power
,
isExp
);
...
...
source/core/shape/Merge.cpp
查看文件 @
f6fe574c
...
...
@@ -63,11 +63,6 @@ void Merge(XTensor * s, XTensor * t, int whereToMerge, int leadingDim)
}
}
/* make tensor connections */
XLink
::
MakeLink
(
s
,
NULL
,
t
,
MATH_MERGE
);
XLink
::
AddParamToHeadInt
(
t
,
whereToMerge
);
XLink
::
AddParamToHeadInt
(
t
,
leadingDim
);
int
blockSize
=
1
;
int
blockNum
=
1
;
int
gridSize
=
1
;
...
...
source/core/shape/Unsqueeze.cpp
查看文件 @
f6fe574c
...
...
@@ -40,11 +40,6 @@ void Unsqueeze(XTensor * a, XTensor * b, int dim, int dSize)
CheckNTErrors
((
a
->
order
==
b
->
order
-
1
),
"Unmatched tensors!"
);
CheckNTErrors
((
a
->
unitSize
==
b
->
unitSize
),
"Unmatched tensors!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
NULL
,
b
,
MATH_UNSQUEEZE
);
XLink
::
AddParamToHeadInt
(
b
,
dim
);
XLink
::
AddParamToHeadInt
(
b
,
dSize
);
int
dimRDI
=
b
->
order
-
dim
-
1
;
for
(
int
i
=
0
;
i
<
b
->
order
;
i
++
)
{
if
(
i
<
dimRDI
)
{
...
...
@@ -99,4 +94,4 @@ void Unsqueeze(XTensor * a, XTensor * b, int dim, int dSize)
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
source/core/sort/Sort.cpp
查看文件 @
f6fe574c
...
...
@@ -39,10 +39,6 @@ void Sort(XTensor * a, XTensor * index, int dim)
CheckNTErrors
((
a
->
order
==
index
->
order
),
"Unmatched input tensors!"
);
CheckNTErrors
((
index
->
dataType
==
X_INT
),
"Wrong data type!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
NULL
,
index
,
MATH_SORT
);
XLink
::
AddParamToHeadInt
(
index
,
dim
);
int
dimRDI
=
a
->
order
-
dim
-
1
;
/* make the index tensor */
index
->
SetAscendingOrder
(
dim
);
...
...
@@ -81,4 +77,4 @@ void Sort(XTensor * a, XTensor * index, int dim)
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
source/core/sort/TopK.cpp
查看文件 @
f6fe574c
...
...
@@ -41,11 +41,6 @@ void TopK(XTensor * a, XTensor * b, XTensor * index, int dim, int k)
CheckNTErrors
((
index
==
NULL
||
a
->
order
==
index
->
order
),
"Unmatched input tensors!"
);
CheckNTErrors
((
index
->
dataType
==
X_INT
),
"Wrong data type!"
);
/* make tensor connections */
XLink
::
MakeLink
(
a
,
b
,
index
,
MATH_TOPK
);
XLink
::
AddParamToHeadInt
(
index
,
dim
);
XLink
::
AddParamToHeadInt
(
index
,
k
);
int
dimRDI
=
a
->
order
-
dim
-
1
;
for
(
int
i
=
0
;
i
<
a
->
order
;
i
++
)
{
if
(
i
==
dimRDI
)
{
...
...
@@ -110,4 +105,4 @@ void TopK(XTensor * a, XTensor * b, XTensor * index, int dim, int k)
}
}
}
}
//
namespace
nts
(
NiuTrans
.
Tensor
)
\ No newline at end of file
}
// namespace nts(NiuTrans.Tensor)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论