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
78954fad
Commit
78954fad
authored
Nov 29, 2018
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revise the comment
parent
dc56fd67
隐藏空白字符变更
内嵌
并排
正在显示
70 个修改的文件
包含
92 行增加
和
92 行删除
+92
-92
source/tensor/core/arithmetic/Div.cpp
+1
-1
source/tensor/core/arithmetic/Div.h
+1
-1
source/tensor/core/arithmetic/DivDim.cpp
+1
-1
source/tensor/core/arithmetic/MatrixMul.cpp
+1
-1
source/tensor/core/arithmetic/MatrixMul.h
+1
-1
source/tensor/core/arithmetic/MatrixMulBatched.h
+2
-2
source/tensor/core/arithmetic/Multiply.cpp
+1
-1
source/tensor/core/arithmetic/Multiply.h
+1
-1
source/tensor/core/arithmetic/MultiplyDim.cpp
+1
-1
source/tensor/core/arithmetic/Negate.cpp
+1
-1
source/tensor/core/arithmetic/Negate.h
+1
-1
source/tensor/core/arithmetic/Sign.cpp
+1
-1
source/tensor/core/arithmetic/Sign.h
+1
-1
source/tensor/core/arithmetic/Sub.cpp
+1
-1
source/tensor/core/arithmetic/SubDim.cpp
+1
-1
source/tensor/core/arithmetic/Sum.cpp
+1
-1
source/tensor/core/arithmetic/SumDim.cpp
+1
-1
source/tensor/core/getandset/Select.cpp
+1
-1
source/tensor/core/getandset/Select.h
+1
-1
source/tensor/core/math/Clip.cpp
+1
-1
source/tensor/core/math/Clip.h
+1
-1
source/tensor/core/math/Normalize.cpp
+1
-1
source/tensor/core/math/Normalize.h
+1
-1
source/tensor/core/math/Power.cpp
+1
-1
source/tensor/core/math/Power.h
+1
-1
source/tensor/core/math/ScaleAndShift.cpp
+1
-1
source/tensor/core/math/Unary.h
+13
-13
source/tensor/core/movement/CopyIndexed.cpp
+1
-1
source/tensor/core/movement/CopyIndexed.h
+2
-2
source/tensor/core/movement/CopyValues.cpp
+1
-1
source/tensor/core/movement/CopyValues.h
+1
-1
source/tensor/core/movement/Gather.cpp
+1
-1
source/tensor/core/movement/Gather.h
+1
-1
source/tensor/core/movement/Spread.h
+1
-1
source/tensor/core/reduce/ReduceMax.cpp
+1
-1
source/tensor/core/reduce/ReduceMax.h
+1
-1
source/tensor/core/reduce/ReduceMean.cpp
+1
-1
source/tensor/core/reduce/ReduceMean.h
+1
-1
source/tensor/core/reduce/ReduceSum.cpp
+2
-2
source/tensor/core/reduce/ReduceSum.h
+2
-2
source/tensor/core/reduce/ReduceSumSquared.cpp
+1
-1
source/tensor/core/reduce/ReduceSumSquared.h
+1
-1
source/tensor/core/reduce/ReduceVariance.cpp
+1
-1
source/tensor/core/reduce/ReduceVariance.h
+1
-1
source/tensor/core/shape/Concatenate.cpp
+2
-2
source/tensor/core/shape/Concatenate.h
+2
-2
source/tensor/core/shape/Merge.cpp
+3
-3
source/tensor/core/shape/Merge.h
+3
-3
source/tensor/core/shape/Permute.h
+1
-1
source/tensor/core/shape/Split.cpp
+1
-1
source/tensor/core/shape/Split.h
+1
-1
source/tensor/core/shape/Squeeze.cpp
+1
-1
source/tensor/core/shape/Squeeze.h
+1
-1
source/tensor/core/shape/Transpose.cpp
+1
-1
source/tensor/core/shape/Transpose.h
+1
-1
source/tensor/core/shape/Unsqueeze.h
+1
-1
source/tensor/core/sort/Sort.cpp
+1
-1
source/tensor/core/sort/Sort.h
+1
-1
source/tensor/function/HardTanH.cpp
+1
-1
source/tensor/function/HardTanH.h
+1
-1
source/tensor/function/Identity.cpp
+1
-1
source/tensor/function/Identity.h
+1
-1
source/tensor/function/LogSoftmax.cpp
+1
-1
source/tensor/function/LogSoftmax.h
+1
-1
source/tensor/function/Rectify.cpp
+1
-1
source/tensor/function/Rectify.h
+1
-1
source/tensor/function/Sigmoid.cpp
+1
-1
source/tensor/function/Sigmoid.h
+1
-1
source/tensor/function/Softmax.cpp
+1
-1
source/tensor/function/Softmax.h
+1
-1
没有找到文件。
source/tensor/core/arithmetic/Div.cpp
查看文件 @
78954fad
...
@@ -168,7 +168,7 @@ int GetDivDimIndex(const XTensor &a, const XTensor &b)
...
@@ -168,7 +168,7 @@ int GetDivDimIndex(const XTensor &a, const XTensor &b)
}
}
/*
/*
element-wise division of two tensors (return a XTensor structure)
element-wise division of two tensors (return a
n
XTensor structure)
make a new tensor c to keep the result and return it
make a new tensor c to keep the result and return it
c(i) = a(i)*b(i)
c(i) = a(i)*b(i)
...
...
source/tensor/core/arithmetic/Div.h
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ where i is the index of the element
...
@@ -42,7 +42,7 @@ where i is the index of the element
void
_DivMe
(
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
alpha
=
0
.
0
,
int
leadingDim
=
0
);
void
_DivMe
(
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
alpha
=
0
.
0
,
int
leadingDim
=
0
);
/*
/*
element-wise division of two tensors (return a XTensor structure)
element-wise division of two tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c(i) = a(i)/b(i)
c(i) = a(i)/b(i)
where i is the index of the element
where i is the index of the element
...
...
source/tensor/core/arithmetic/DivDim.cpp
查看文件 @
78954fad
...
@@ -133,7 +133,7 @@ void _DivDim(XTensor * a, const XTensor * b, int n, DTYPE alpha)
...
@@ -133,7 +133,7 @@ void _DivDim(XTensor * a, const XTensor * b, int n, DTYPE alpha)
}
}
/*
/*
tensor division of two tensors (return a XTensor structure and make tensor connections)
tensor division of two tensors (return a
n
XTensor structure and make tensor connections)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = a/b + \alpha * c
c = a/b + \alpha * c
...
...
source/tensor/core/arithmetic/MatrixMul.cpp
查看文件 @
78954fad
...
@@ -203,7 +203,7 @@ void _MatrixMul(const XTensor * a, MATRIX_TRANS_TYPE transposedA,
...
@@ -203,7 +203,7 @@ void _MatrixMul(const XTensor * a, MATRIX_TRANS_TYPE transposedA,
}
}
/*
/*
matrix multiplication (return a XTensor structure) c = trans(a) * trans(b) * alpha
matrix multiplication (return a
n
XTensor structure) c = trans(a) * trans(b) * alpha
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For the input tensors a and b, we perform matrix multiplication on the first two dimentsions.
For the input tensors a and b, we perform matrix multiplication on the first two dimentsions.
...
...
source/tensor/core/arithmetic/MatrixMul.h
查看文件 @
78954fad
...
@@ -44,7 +44,7 @@ void _MatrixMul(const XTensor * a, MATRIX_TRANS_TYPE transposedA, const XTensor
...
@@ -44,7 +44,7 @@ void _MatrixMul(const XTensor * a, MATRIX_TRANS_TYPE transposedA, const XTensor
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
DTYPE
beta
=
0
,
XPRunner
*
parallelRunner
=
NULL
);
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
DTYPE
beta
=
0
,
XPRunner
*
parallelRunner
=
NULL
);
/*
/*
matrix multiplication (return a XTensor structure) c = trans(a) * trans(b) * alpha
matrix multiplication (return a
n
XTensor structure) c = trans(a) * trans(b) * alpha
make a new tensor c to keep the result and return it
make a new tensor c to keep the result and return it
For the input tensors a and b, we perform matrix multiplicationon the first two dimentsions.
For the input tensors a and b, we perform matrix multiplicationon the first two dimentsions.
...
...
source/tensor/core/arithmetic/MatrixMulBatched.h
查看文件 @
78954fad
...
@@ -62,7 +62,7 @@ void _MatrixMulBatchedCPU(const XList * a, MATRIX_TRANS_TYPE transposedA, const
...
@@ -62,7 +62,7 @@ void _MatrixMulBatchedCPU(const XList * a, MATRIX_TRANS_TYPE transposedA, const
XList
*
c
,
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
DTYPE
beta
=
0
);
XList
*
c
,
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
DTYPE
beta
=
0
);
/*
/*
matrix multiplication of the two tensors (return a XTensor structure) c = trans(a) * trans(b) * alpha
matrix multiplication of the two tensors (return a
n
XTensor structure) c = trans(a) * trans(b) * alpha
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
for each 2-dimensional data array in a (denoted as ai) and
for each 2-dimensional data array in a (denoted as ai) and
...
@@ -74,7 +74,7 @@ XTensor MatrixMulBatched(const XTensor &a, MATRIX_TRANS_TYPE transposedA, const
...
@@ -74,7 +74,7 @@ XTensor MatrixMulBatched(const XTensor &a, MATRIX_TRANS_TYPE transposedA, const
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
XPRunner
*
parallelRunner
=
NULL
);
DTYPE
alpha
=
(
DTYPE
)
1
.
0
,
XPRunner
*
parallelRunner
=
NULL
);
/*
/*
matrix multiplication of the two tensors (return a XTensor structure) c = a * b * alpha
matrix multiplication of the two tensors (return a
n
XTensor structure) c = a * b * alpha
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
for each 2-dimensional data array in a (denoted as ai) and
for each 2-dimensional data array in a (denoted as ai) and
...
...
source/tensor/core/arithmetic/Multiply.cpp
查看文件 @
78954fad
...
@@ -169,7 +169,7 @@ int GetMultiplyDimIndex(const XTensor &a, const XTensor &b)
...
@@ -169,7 +169,7 @@ int GetMultiplyDimIndex(const XTensor &a, const XTensor &b)
}
}
/*
/*
element-wise product of two tensors (return a XTensor structure)
element-wise product of two tensors (return a
n
XTensor structure)
make a new tensor c to keep the result and return it
make a new tensor c to keep the result and return it
c(i) = a(i)*b(i)
c(i) = a(i)*b(i)
...
...
source/tensor/core/arithmetic/Multiply.h
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ where i is the index of the element
...
@@ -42,7 +42,7 @@ where i is the index of the element
void
_MultiplyMe
(
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
alpha
=
0
.
0
,
int
leadingDim
=
0
);
void
_MultiplyMe
(
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
alpha
=
0
.
0
,
int
leadingDim
=
0
);
/*
/*
element-wise product of two tensors (return a XTensor structure)
element-wise product of two tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c(i) = a(i)*b(i)
c(i) = a(i)*b(i)
where i is the index of the element
where i is the index of the element
...
...
source/tensor/core/arithmetic/MultiplyDim.cpp
查看文件 @
78954fad
...
@@ -132,7 +132,7 @@ void _MultiplyDimMe(XTensor * a, const XTensor * b, int n, DTYPE alpha)
...
@@ -132,7 +132,7 @@ void _MultiplyDimMe(XTensor * a, const XTensor * b, int n, DTYPE alpha)
}
}
/*
/*
tensor multiplication (return a XTensor structure and make tensor connections)
tensor multiplication (return a
n
XTensor structure and make tensor connections)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = a * b + \alpha * c
c = a * b + \alpha * c
...
...
source/tensor/core/arithmetic/Negate.cpp
查看文件 @
78954fad
...
@@ -60,7 +60,7 @@ void _NegateMe(XTensor * a)
...
@@ -60,7 +60,7 @@ void _NegateMe(XTensor * a)
}
}
/*
/*
set every entry to its minus value (return a XTensor structure)
set every entry to its minus value (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> a - input tensor we are processing
>> a - input tensor we are processing
<< return - the minus value of input tensor
<< return - the minus value of input tensor
...
...
source/tensor/core/arithmetic/Negate.h
查看文件 @
78954fad
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
void
_NegateMe
(
XTensor
*
a
);
void
_NegateMe
(
XTensor
*
a
);
/*
/*
set every entry to its minus value (return a XTensor structure)
set every entry to its minus value (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
Negate
(
const
XTensor
&
a
);
XTensor
Negate
(
const
XTensor
&
a
);
...
...
source/tensor/core/arithmetic/Sign.cpp
查看文件 @
78954fad
...
@@ -66,7 +66,7 @@ void _SignMe(XTensor * a)
...
@@ -66,7 +66,7 @@ void _SignMe(XTensor * a)
}
}
/*
/*
set every entry to its sign value (return a XTensor structure)
set every entry to its sign value (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> a - input tensor we are processing
>> a - input tensor we are processing
<< return - the sign value of the input tensor
<< return - the sign value of the input tensor
...
...
source/tensor/core/arithmetic/Sign.h
查看文件 @
78954fad
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
void
_SignMe
(
XTensor
*
a
);
void
_SignMe
(
XTensor
*
a
);
/*
/*
set every entry to its sign value (return a XTensor structure)
set every entry to its sign value (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
Sign
(
const
XTensor
&
a
);
XTensor
Sign
(
const
XTensor
&
a
);
...
...
source/tensor/core/arithmetic/Sub.cpp
查看文件 @
78954fad
...
@@ -155,7 +155,7 @@ int GetSubDimIndex(const XTensor &a, const XTensor &b)
...
@@ -155,7 +155,7 @@ int GetSubDimIndex(const XTensor &a, const XTensor &b)
}
}
/*
/*
tensor subtraction c = a - b * \beta (return a XTensor structure)
tensor subtraction c = a - b * \beta (return a
n
XTensor structure)
make a new tensor c to keep the result and return it
make a new tensor c to keep the result and return it
>> a - a tensor
>> a - a tensor
...
...
source/tensor/core/arithmetic/SubDim.cpp
查看文件 @
78954fad
...
@@ -134,7 +134,7 @@ void _SubDim(XTensor * a, const XTensor * b, int n, DTYPE beta)
...
@@ -134,7 +134,7 @@ void _SubDim(XTensor * a, const XTensor * b, int n, DTYPE beta)
}
}
/*
/*
tensor subtraction (return a XTensor structure and make tensor connections)
tensor subtraction (return a
n
XTensor structure and make tensor connections)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = a - b * \beta
c = a - b * \beta
...
...
source/tensor/core/arithmetic/Sum.cpp
查看文件 @
78954fad
...
@@ -160,7 +160,7 @@ int GetSumDimIndex(const XTensor &a, const XTensor &b)
...
@@ -160,7 +160,7 @@ int GetSumDimIndex(const XTensor &a, const XTensor &b)
}
}
/*
/*
tensor summation c = a + b * \beta (return a XTensor structure)
tensor summation c = a + b * \beta (return a
n
XTensor structure)
make a new tensor c to keep the result and return it
make a new tensor c to keep the result and return it
>> a - a tensor
>> a - a tensor
...
...
source/tensor/core/arithmetic/SumDim.cpp
查看文件 @
78954fad
...
@@ -134,7 +134,7 @@ void _SumDim(XTensor * a, const XTensor * b, int n, DTYPE beta)
...
@@ -134,7 +134,7 @@ void _SumDim(XTensor * a, const XTensor * b, int n, DTYPE beta)
}
}
/*
/*
tensor summation (return a XTensor structure and make tensor connections)
tensor summation (return a
n
XTensor structure and make tensor connections)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = a + b * \beta
c = a + b * \beta
...
...
source/tensor/core/getandset/Select.cpp
查看文件 @
78954fad
...
@@ -79,7 +79,7 @@ void _SelectRange(const XTensor * a, XTensor * c, int dim, int low, int high)
...
@@ -79,7 +79,7 @@ void _SelectRange(const XTensor * a, XTensor * c, int dim, int low, int high)
}
}
/*
/*
generate a tensor with selected data in range[low,high] along the given dimension (return a XTensor structure)
generate a tensor with selected data in range[low,high] along the given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = select(a)
c = select(a)
...
...
source/tensor/core/getandset/Select.h
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ c = select(a)
...
@@ -42,7 +42,7 @@ c = select(a)
void
_SelectRange
(
const
XTensor
*
a
,
XTensor
*
c
,
int
dim
,
int
low
,
int
high
);
void
_SelectRange
(
const
XTensor
*
a
,
XTensor
*
c
,
int
dim
,
int
low
,
int
high
);
/*
/*
generate a tensor with selected data in range[low,high] along the given dimension (return a XTensor structure)
generate a tensor with selected data in range[low,high] along the given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
c = select(a)
c = select(a)
*/
*/
...
...
source/tensor/core/math/Clip.cpp
查看文件 @
78954fad
...
@@ -71,7 +71,7 @@ void _ClipMe(XTensor * a, DTYPE lower, DTYPE upper)
...
@@ -71,7 +71,7 @@ void _ClipMe(XTensor * a, DTYPE lower, DTYPE upper)
}
}
/*
/*
set every entry to its clip value (return a XTensor structure)
set every entry to its clip value (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> a - input tensor we are processing
>> a - input tensor we are processing
>> lower - the lower border
>> lower - the lower border
...
...
source/tensor/core/math/Clip.h
查看文件 @
78954fad
...
@@ -34,7 +34,7 @@ void _Clip(const XTensor * a, XTensor * b, DTYPE lower, DTYPE upper);
...
@@ -34,7 +34,7 @@ void _Clip(const XTensor * a, XTensor * b, DTYPE lower, DTYPE upper);
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_ClipMe
(
XTensor
*
a
,
DTYPE
lower
,
DTYPE
upper
);
void
_ClipMe
(
XTensor
*
a
,
DTYPE
lower
,
DTYPE
upper
);
/* set every entry to its clip value (return a XTensor structure)
/* set every entry to its clip value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Clip
(
const
XTensor
&
a
,
DTYPE
lower
,
DTYPE
upper
);
XTensor
Clip
(
const
XTensor
&
a
,
DTYPE
lower
,
DTYPE
upper
);
...
...
source/tensor/core/math/Normalize.cpp
查看文件 @
78954fad
...
@@ -114,7 +114,7 @@ void _NormalizeMe(XTensor * input, int dim, const XTensor * mean, const XTensor
...
@@ -114,7 +114,7 @@ void _NormalizeMe(XTensor * input, int dim, const XTensor * mean, const XTensor
_Normalize
(
input
,
input
,
dim
,
mean
,
var
,
a
,
b
,
epsilon
);
_Normalize
(
input
,
input
,
dim
,
mean
,
var
,
a
,
b
,
epsilon
);
}
}
/*
/*
normalized the data with normal distribution (return a XTensor structure)
normalized the data with normal distribution (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For an input x, y = a * (x-mean)/sqrt(variance+\epsilon) + b
For an input x, y = a * (x-mean)/sqrt(variance+\epsilon) + b
...
...
source/tensor/core/math/Normalize.h
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ where a and b are the scalar and bias respectively, and \epsilon is the adjustme
...
@@ -42,7 +42,7 @@ where a and b are the scalar and bias respectively, and \epsilon is the adjustme
void
_NormalizeMe
(
XTensor
*
input
,
int
dim
,
const
XTensor
*
mean
,
const
XTensor
*
var
,
const
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
epsilon
);
void
_NormalizeMe
(
XTensor
*
input
,
int
dim
,
const
XTensor
*
mean
,
const
XTensor
*
var
,
const
XTensor
*
a
,
const
XTensor
*
b
,
DTYPE
epsilon
);
/*
/*
normalized the data with normal distribution (return a XTensor structure)
normalized the data with normal distribution (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For an input x, y = a * (x-mean)/sqrt(variance+\epsilon) + b
For an input x, y = a * (x-mean)/sqrt(variance+\epsilon) + b
where a and b are the scalar and bias respectively, and \epsilon is the adjustment parameter.
where a and b are the scalar and bias respectively, and \epsilon is the adjustment parameter.
...
...
source/tensor/core/math/Power.cpp
查看文件 @
78954fad
...
@@ -81,7 +81,7 @@ void _PowerMe(XTensor * a, DTYPE p)
...
@@ -81,7 +81,7 @@ void _PowerMe(XTensor * a, DTYPE p)
}
}
/*
/*
get the power(a, p) (return a XTensor structure)
get the power(a, p) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> a - input tensor
>> a - input tensor
>> p - parameter
>> p - parameter
...
...
source/tensor/core/math/Power.h
查看文件 @
78954fad
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
void
_PowerMe
(
XTensor
*
a
,
DTYPE
p
);
void
_PowerMe
(
XTensor
*
a
,
DTYPE
p
);
/*
/*
get the power(x, y) (return a XTensor structure)
get the power(x, y) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
Power
(
const
XTensor
&
a
,
DTYPE
p
);
XTensor
Power
(
const
XTensor
&
a
,
DTYPE
p
);
...
...
source/tensor/core/math/ScaleAndShift.cpp
查看文件 @
78954fad
...
@@ -92,7 +92,7 @@ void _ScaleAndShiftMe(XTensor * a, DTYPE scale, DTYPE shift)
...
@@ -92,7 +92,7 @@ void _ScaleAndShiftMe(XTensor * a, DTYPE scale, DTYPE shift)
}
}
/*
/*
scale and shift all tensor entires (return a XTensor structure)
scale and shift all tensor entires (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
b = a * scale + shift
b = a * scale + shift
...
...
source/tensor/core/math/Unary.h
查看文件 @
78954fad
...
@@ -32,7 +32,7 @@ void _Absolute(const XTensor * a, XTensor * b);
...
@@ -32,7 +32,7 @@ void _Absolute(const XTensor * a, XTensor * b);
/* set every entry to its absolute value (do it on site)
/* set every entry to its absolute value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_AbsoluteMe
(
XTensor
*
a
);
void
_AbsoluteMe
(
XTensor
*
a
);
/* set every entry to its absolute value (return a XTensor structure)
/* set every entry to its absolute value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Absolute
(
const
XTensor
&
a
);
XTensor
Absolute
(
const
XTensor
&
a
);
...
@@ -41,7 +41,7 @@ void _Ceil(const XTensor * a, XTensor * b);
...
@@ -41,7 +41,7 @@ void _Ceil(const XTensor * a, XTensor * b);
/* set every entry to its ceil value (do it on site)
/* set every entry to its ceil value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_CeilMe
(
XTensor
*
a
);
void
_CeilMe
(
XTensor
*
a
);
/* set every entry to its ceil value (return a XTensor structure)
/* set every entry to its ceil value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Ceil
(
const
XTensor
&
a
);
XTensor
Ceil
(
const
XTensor
&
a
);
...
@@ -50,7 +50,7 @@ void _Exp(const XTensor * a, XTensor * b);
...
@@ -50,7 +50,7 @@ void _Exp(const XTensor * a, XTensor * b);
/* set every entry to its exponent value (do it on site)
/* set every entry to its exponent value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_ExpMe
(
XTensor
*
a
);
void
_ExpMe
(
XTensor
*
a
);
/* set every entry to its exponent value (return a XTensor structure)
/* set every entry to its exponent value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Exp
(
const
XTensor
&
a
);
XTensor
Exp
(
const
XTensor
&
a
);
...
@@ -59,7 +59,7 @@ void _Floor(const XTensor * a, XTensor * b);
...
@@ -59,7 +59,7 @@ void _Floor(const XTensor * a, XTensor * b);
/* set every entry to its floor value (do it on site)
/* set every entry to its floor value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_FloorMe
(
XTensor
*
a
);
void
_FloorMe
(
XTensor
*
a
);
/* set every entry to its floor value (return a XTensor structure)
/* set every entry to its floor value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Floor
(
const
XTensor
&
a
);
XTensor
Floor
(
const
XTensor
&
a
);
...
@@ -68,7 +68,7 @@ void _IsNonZero(const XTensor *a, XTensor *b);
...
@@ -68,7 +68,7 @@ void _IsNonZero(const XTensor *a, XTensor *b);
/* if source entry is non-zero, set target entry to be one, otherwise zero (do it on site)
/* if source entry is non-zero, set target entry to be one, otherwise zero (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_IsNonZeroMe
(
XTensor
*
a
);
void
_IsNonZeroMe
(
XTensor
*
a
);
/* if source entry is non-zero, set target entry to be one, otherwise zero (return a XTensor structure)
/* if source entry is non-zero, set target entry to be one, otherwise zero (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
IsNonZero
(
const
XTensor
&
a
);
XTensor
IsNonZero
(
const
XTensor
&
a
);
...
@@ -77,7 +77,7 @@ void _IsZero(const XTensor *a, XTensor *b);
...
@@ -77,7 +77,7 @@ void _IsZero(const XTensor *a, XTensor *b);
/* if source entry is zero, set target entry to be one, otherwise zero (do it on site)
/* if source entry is zero, set target entry to be one, otherwise zero (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_IsZeroMe
(
XTensor
*
a
);
void
_IsZeroMe
(
XTensor
*
a
);
/* if source entry is zero, set target entry to be one, otherwise zero (return a XTensor structure)
/* if source entry is zero, set target entry to be one, otherwise zero (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
IsZero
(
const
XTensor
&
a
);
XTensor
IsZero
(
const
XTensor
&
a
);
...
@@ -86,7 +86,7 @@ void _Log(const XTensor * a, XTensor * b);
...
@@ -86,7 +86,7 @@ void _Log(const XTensor * a, XTensor * b);
/* set every entry to its logarithm value (do it on site)
/* set every entry to its logarithm value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_LogMe
(
XTensor
*
a
);
void
_LogMe
(
XTensor
*
a
);
/* set every entry to its logarithm value (return a XTensor structure)
/* set every entry to its logarithm value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Log
(
const
XTensor
&
a
);
XTensor
Log
(
const
XTensor
&
a
);
...
@@ -95,7 +95,7 @@ void _Round(const XTensor * a, XTensor * b);
...
@@ -95,7 +95,7 @@ void _Round(const XTensor * a, XTensor * b);
/* set every entry to its round value (do it on site)
/* set every entry to its round value (do it on site)
keep the result in the input tensor a and return nothing */
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)
/* set every entry to its round value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Round
(
const
XTensor
&
a
);
XTensor
Round
(
const
XTensor
&
a
);
...
@@ -104,7 +104,7 @@ void _Sqrt(const XTensor * a, XTensor * b);
...
@@ -104,7 +104,7 @@ void _Sqrt(const XTensor * a, XTensor * b);
/* set every entry to its sqrt value (do it on site)
/* set every entry to its sqrt value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_SqrtMe
(
XTensor
*
a
);
void
_SqrtMe
(
XTensor
*
a
);
/* set every entry to its sqrt value (return a XTensor structure)
/* set every entry to its sqrt value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Sqrt
(
const
XTensor
&
a
);
XTensor
Sqrt
(
const
XTensor
&
a
);
...
@@ -113,7 +113,7 @@ void _Square(const XTensor * a, XTensor * b);
...
@@ -113,7 +113,7 @@ void _Square(const XTensor * a, XTensor * b);
/* set every entry to its square value (do it on site)
/* set every entry to its square value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_SquareMe
(
XTensor
*
a
);
void
_SquareMe
(
XTensor
*
a
);
/* set every entry to its square value (return a XTensor structure)
/* set every entry to its square value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Square
(
const
XTensor
&
a
);
XTensor
Square
(
const
XTensor
&
a
);
...
@@ -123,7 +123,7 @@ void _Sin(const XTensor * a, XTensor * b);
...
@@ -123,7 +123,7 @@ void _Sin(const XTensor * a, XTensor * b);
/* set every entry to its sine value (do it on site)
/* set every entry to its sine value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_SinMe
(
XTensor
*
a
);
void
_SinMe
(
XTensor
*
a
);
/* set every entry to its sine value (return a XTensor structure)
/* set every entry to its sine value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Sin
(
const
XTensor
&
a
);
XTensor
Sin
(
const
XTensor
&
a
);
...
@@ -132,7 +132,7 @@ void _Cos(const XTensor * a, XTensor * b);
...
@@ -132,7 +132,7 @@ void _Cos(const XTensor * a, XTensor * b);
/* set every entry to its cosine value (do it on site)
/* set every entry to its cosine value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_CosMe
(
XTensor
*
a
);
void
_CosMe
(
XTensor
*
a
);
/* set every entry to its cosine value (return a XTensor structure)
/* set every entry to its cosine value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Cos
(
const
XTensor
&
a
);
XTensor
Cos
(
const
XTensor
&
a
);
...
@@ -141,7 +141,7 @@ void _Tan(const XTensor * a, XTensor * b);
...
@@ -141,7 +141,7 @@ void _Tan(const XTensor * a, XTensor * b);
/* set every entry to its tangent value (do it on site)
/* set every entry to its tangent value (do it on site)
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_TanMe
(
XTensor
*
a
);
void
_TanMe
(
XTensor
*
a
);
/* set every entry to its tangent value (return a XTensor structure)
/* set every entry to its tangent value (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Tan
(
const
XTensor
&
a
);
XTensor
Tan
(
const
XTensor
&
a
);
...
...
source/tensor/core/movement/CopyIndexed.cpp
查看文件 @
78954fad
...
@@ -99,7 +99,7 @@ void _CopyIndexed(const XTensor * s, XTensor * t, int dim, int * srcIndex, int i
...
@@ -99,7 +99,7 @@ void _CopyIndexed(const XTensor * s, XTensor * t, int dim, int * srcIndex, int i
}
}
/*
/*
copy indexed sub-tensors (return a XTensor structure)
copy indexed sub-tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> s - the source tensor
>> s - the source tensor
...
...
source/tensor/core/movement/CopyIndexed.h
查看文件 @
78954fad
...
@@ -33,13 +33,13 @@ void _CopyIndexed(const XTensor * s, XTensor * t, int dim, int * srcIndex, int i
...
@@ -33,13 +33,13 @@ void _CopyIndexed(const XTensor * s, XTensor * t, int dim, int * srcIndex, int i
void
_CopyIndexed
(
const
XTensor
*
s
,
XTensor
*
t
,
int
dim
,
const
XTensor
*
srcIndex
,
const
XTensor
*
tgtIndex
);
void
_CopyIndexed
(
const
XTensor
*
s
,
XTensor
*
t
,
int
dim
,
const
XTensor
*
srcIndex
,
const
XTensor
*
tgtIndex
);
/*
/*
copy selected sub-tensors (return a XTensor structure)
copy selected sub-tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it (remove this???)
make a new tensor to keep the result and return it (remove this???)
*/
*/
XTensor
CopyIndexed
(
const
XTensor
&
s
,
int
dim
,
int
*
srcIndex
,
int
indexSize
,
int
*
tgtIndex
,
int
copyNum
);
XTensor
CopyIndexed
(
const
XTensor
&
s
,
int
dim
,
int
*
srcIndex
,
int
indexSize
,
int
*
tgtIndex
,
int
copyNum
);
/*
/*
copy selected sub-tensors where indeces are kept in tensors (return a XTensor structure)
copy selected sub-tensors where indeces are kept in tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it (remove this???)
make a new tensor to keep the result and return it (remove this???)
*/
*/
void
CopyIndexed
(
const
XTensor
*
s
,
XTensor
*
t
,
int
dim
,
const
XTensor
*
srcIndex
,
const
XTensor
*
tgtIndex
);
void
CopyIndexed
(
const
XTensor
*
s
,
XTensor
*
t
,
int
dim
,
const
XTensor
*
srcIndex
,
const
XTensor
*
tgtIndex
);
...
...
source/tensor/core/movement/CopyValues.cpp
查看文件 @
78954fad
...
@@ -98,7 +98,7 @@ void _CopyValues(const XTensor * s, const int sBeg, const int sLen, XTensor * t,
...
@@ -98,7 +98,7 @@ void _CopyValues(const XTensor * s, const int sBeg, const int sLen, XTensor * t,
}
}
/*
/*
copy s to t (return a XTensor structure)
copy s to t (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> s - source
>> s - source
...
...
source/tensor/core/movement/CopyValues.h
查看文件 @
78954fad
...
@@ -33,7 +33,7 @@ void _CopyValues(const XTensor * s, XTensor * t, XStream * stream = NULL);
...
@@ -33,7 +33,7 @@ void _CopyValues(const XTensor * s, XTensor * t, XStream * stream = NULL);
void
_CopyValues
(
const
XTensor
*
s
,
const
int
sBeg
,
const
int
sLen
,
XTensor
*
t
,
const
int
tBeg
,
XStream
*
stream
=
NULL
);
void
_CopyValues
(
const
XTensor
*
s
,
const
int
sBeg
,
const
int
sLen
,
XTensor
*
t
,
const
int
tBeg
,
XStream
*
stream
=
NULL
);
/*
/*
copy s to t (return a XTensor structure)
copy s to t (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
CopyValues
(
const
XTensor
&
s
,
XStream
*
stream
=
NULL
);
XTensor
CopyValues
(
const
XTensor
&
s
,
XStream
*
stream
=
NULL
);
...
...
source/tensor/core/movement/Gather.cpp
查看文件 @
78954fad
...
@@ -89,7 +89,7 @@ void _Gather(XTensor * s, XTensor * t, XTensor * srcIndex)
...
@@ -89,7 +89,7 @@ void _Gather(XTensor * s, XTensor * t, XTensor * srcIndex)
}
}
/*
/*
gather indexed sub-tensors (return a XTensor structure)
gather indexed sub-tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> s - the source tensor(2D)
>> s - the source tensor(2D)
...
...
source/tensor/core/movement/Gather.h
查看文件 @
78954fad
...
@@ -32,7 +32,7 @@ void _Gather(XTensor * s, XTensor * t, int dim, int * srcIndex, int indexSize);
...
@@ -32,7 +32,7 @@ void _Gather(XTensor * s, XTensor * t, int dim, int * srcIndex, int indexSize);
/* gather selected sub-tensors */
/* gather selected sub-tensors */
void
_Gather
(
XTensor
*
s
,
XTensor
*
t
,
XTensor
*
srcIndex
);
void
_Gather
(
XTensor
*
s
,
XTensor
*
t
,
XTensor
*
srcIndex
);
/* gather selected sub-tensors (return a XTensor structure)
/* gather selected sub-tensors (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Gather
(
XTensor
&
s
,
XTensor
&
index
);
XTensor
Gather
(
XTensor
&
s
,
XTensor
&
index
);
...
...
source/tensor/core/movement/Spread.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
void
_Spread
(
XTensor
*
source
,
XTensor
*
collection
,
int
dim
,
void
_Spread
(
XTensor
*
source
,
XTensor
*
collection
,
int
dim
,
int
*
srcIndex
,
int
indexSize
,
int
*
collIndex
);
int
*
srcIndex
,
int
indexSize
,
int
*
collIndex
);
/* spread a collection tensor to source tensor (return a XTensor structure)
/* spread a collection tensor to source tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
void
Spread
(
XTensor
*
source
,
XTensor
*
collection
,
void
Spread
(
XTensor
*
source
,
XTensor
*
collection
,
XTensor
*
srcIndex
,
XTensor
*
collIndex
,
XTensor
*
srcIndex
,
XTensor
*
collIndex
,
...
...
source/tensor/core/reduce/ReduceMax.cpp
查看文件 @
78954fad
...
@@ -94,7 +94,7 @@ void _ReduceMax(const XTensor * input, XTensor * output, int dim)
...
@@ -94,7 +94,7 @@ void _ReduceMax(const XTensor * input, XTensor * output, int dim)
}
}
/*
/*
get the max value of the items along a dimension of the tensor (return a XTensor structure).
get the max value of the items along a dimension of the tensor (return a
n
XTensor structure).
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> input - the input tensor
>> input - the input tensor
...
...
source/tensor/core/reduce/ReduceMax.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
void
_ReduceMax
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
void
_ReduceMax
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
/*
/*
get the max value of the items along a dimension of the tensor (return a XTensor structure)
get the max value of the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
ReduceMax
(
const
XTensor
&
input
,
int
dim
);
XTensor
ReduceMax
(
const
XTensor
&
input
,
int
dim
);
...
...
source/tensor/core/reduce/ReduceMean.cpp
查看文件 @
78954fad
...
@@ -47,7 +47,7 @@ void _ReduceMean(const XTensor * input, XTensor * output, int dim)
...
@@ -47,7 +47,7 @@ void _ReduceMean(const XTensor * input, XTensor * output, int dim)
}
}
/*
/*
get the mean value along a dimension of the tensor (return a XTensor structure)
get the mean value along a dimension of the tensor (return a
n
XTensor structure)
make a new tenosr to keep the result and return it
make a new tenosr to keep the result and return it
For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
...
...
source/tensor/core/reduce/ReduceMean.h
查看文件 @
78954fad
...
@@ -33,7 +33,7 @@ For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
...
@@ -33,7 +33,7 @@ For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
void
_ReduceMean
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
void
_ReduceMean
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
/*
/*
get the mean value along a dimension of the tensor (return a XTensor structure)
get the mean value along a dimension of the tensor (return a
n
XTensor structure)
make a new tenosr to keep the result and return it
make a new tenosr to keep the result and return it
For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
For a 1-dimensional data array a, mean = (1/n) * sum_i input_i
*/
*/
...
...
source/tensor/core/reduce/ReduceSum.cpp
查看文件 @
78954fad
...
@@ -198,7 +198,7 @@ void _ReduceSum(const XTensor * input, XTensor * output, int dim, const XTensor
...
@@ -198,7 +198,7 @@ void _ReduceSum(const XTensor * input, XTensor * output, int dim, const XTensor
}
}
/*
/*
sum the items along a dimension of the tensor (return a XTensor structure)
sum the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a,
For a 1-dimensional data array a,
...
@@ -245,7 +245,7 @@ XTensor ReduceSum(const XTensor &input, int dim, const XTensor &shift, DTYPE pow
...
@@ -245,7 +245,7 @@ XTensor ReduceSum(const XTensor &input, int dim, const XTensor &shift, DTYPE pow
}
}
/*
/*
sum the items along a dimension of the tensor (return a XTensor structure)
sum the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a,
For a 1-dimensional data array a,
...
...
source/tensor/core/reduce/ReduceSum.h
查看文件 @
78954fad
...
@@ -36,7 +36,7 @@ void _ReduceSum(const XTensor * input, XTensor * output, int dim, const XTensor
...
@@ -36,7 +36,7 @@ void _ReduceSum(const XTensor * input, XTensor * output, int dim, const XTensor
DTYPE
power
=
(
DTYPE
)
1
.
0
F
,
bool
isExp
=
false
);
DTYPE
power
=
(
DTYPE
)
1
.
0
F
,
bool
isExp
=
false
);
/*
/*
sum the items along a dimension of the tensor (return a XTensor structure)
sum the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a,
For a 1-dimensional data array a,
sum = \sum_i (a_i - shift) if isExp == false
sum = \sum_i (a_i - shift) if isExp == false
...
@@ -45,7 +45,7 @@ sum = \sum_i exp(a_i - shift) if isExp == true
...
@@ -45,7 +45,7 @@ sum = \sum_i exp(a_i - shift) if isExp == true
XTensor
ReduceSum
(
const
XTensor
&
input
,
int
dim
,
const
XTensor
&
shift
,
DTYPE
power
=
(
DTYPE
)
1
.
0
F
,
bool
isExp
=
false
);
XTensor
ReduceSum
(
const
XTensor
&
input
,
int
dim
,
const
XTensor
&
shift
,
DTYPE
power
=
(
DTYPE
)
1
.
0
F
,
bool
isExp
=
false
);
/*
/*
sum the items along a dimension of the tensor (return a XTensor structure)
sum the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a,
For a 1-dimensional data array a,
sum = \sum_i (a_i) if isExp == false
sum = \sum_i (a_i) if isExp == false
...
...
source/tensor/core/reduce/ReduceSumSquared.cpp
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ void _ReduceSumSquared(const XTensor * input, XTensor * output, int dim, const X
...
@@ -42,7 +42,7 @@ void _ReduceSumSquared(const XTensor * input, XTensor * output, int dim, const X
/*
/*
squared sum of the items along a dimension of the tensor (return a XTensor structure)
squared sum of the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a, sum = \sum_i (a_i - shift)^2
For a 1-dimensional data array a, sum = \sum_i (a_i - shift)^2
...
...
source/tensor/core/reduce/ReduceSumSquared.h
查看文件 @
78954fad
...
@@ -34,7 +34,7 @@ sum = \sum_i (a_i - shift)^2
...
@@ -34,7 +34,7 @@ sum = \sum_i (a_i - shift)^2
void
_ReduceSumSquared
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
,
const
XTensor
*
shift
);
void
_ReduceSumSquared
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
,
const
XTensor
*
shift
);
/*
/*
squared sum of the items along a dimension of the tensor (return a XTensor structure)
squared sum of the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a, sum = \sum_i (a_i - shift)^2
For a 1-dimensional data array a, sum = \sum_i (a_i - shift)^2
*/
*/
...
...
source/tensor/core/reduce/ReduceVariance.cpp
查看文件 @
78954fad
...
@@ -45,7 +45,7 @@ void _ReduceVariance(const XTensor * input, XTensor * output, int dim, const XTe
...
@@ -45,7 +45,7 @@ void _ReduceVariance(const XTensor * input, XTensor * output, int dim, const XTe
}
}
/*
/*
variance of the items along a dimension of the tensor (return a XTensor structure)
variance of the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
...
...
source/tensor/core/reduce/ReduceVariance.h
查看文件 @
78954fad
...
@@ -33,7 +33,7 @@ For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
...
@@ -33,7 +33,7 @@ For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
void
_ReduceVariance
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
,
const
XTensor
*
mean
);
void
_ReduceVariance
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
,
const
XTensor
*
mean
);
/*
/*
variance of the items along a dimension of the tensor (return a XTensor structure)
variance of the items along a dimension of the tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
For a 1-dimensional data array a, variance = 1/n * \sum_i (a_i - mean)^2
*/
*/
...
...
source/tensor/core/shape/Concatenate.cpp
查看文件 @
78954fad
...
@@ -55,7 +55,7 @@ void _Concatenate(const XList * smalls, XTensor * big, int dim)
...
@@ -55,7 +55,7 @@ void _Concatenate(const XList * smalls, XTensor * big, int dim)
}
}
/*
/*
concatenate a list of tensors along a given dimension (return a XTensor structure)
concatenate a list of tensors along a given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
Note that this is actually a wrapper that selects "ConcatenateSolely"
Note that this is actually a wrapper that selects "ConcatenateSolely"
...
@@ -155,7 +155,7 @@ void _Concatenate(const XTensor * smallA, const XTensor * smallB, XTensor * big,
...
@@ -155,7 +155,7 @@ void _Concatenate(const XTensor * smallA, const XTensor * smallB, XTensor * big,
}
}
/*
/*
concatenate two tensors along a given dimension (return a XTensor structure).
concatenate two tensors along a given dimension (return a
n
XTensor structure).
make a new tensor to keep the result and return it.
make a new tensor to keep the result and return it.
>> smallA - one tensor for concatenation
>> smallA - one tensor for concatenation
...
...
source/tensor/core/shape/Concatenate.h
查看文件 @
78954fad
...
@@ -34,7 +34,7 @@ Note that this is actually a wrapper that selects
...
@@ -34,7 +34,7 @@ Note that this is actually a wrapper that selects
void
_Concatenate
(
const
XList
*
smalls
,
XTensor
*
big
,
int
dim
);
void
_Concatenate
(
const
XList
*
smalls
,
XTensor
*
big
,
int
dim
);
/*
/*
concatenate a list of tensors along a given dimension (return a XTensor structure)
concatenate a list of tensors along a given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
Note that this is actually a wrapper that selects
Note that this is actually a wrapper that selects
"ConcatenateSolely" or "Merge" by means of the tensor shapes
"ConcatenateSolely" or "Merge" by means of the tensor shapes
...
@@ -45,7 +45,7 @@ XTensor Concatenate(const XList &smalls, int dim);
...
@@ -45,7 +45,7 @@ XTensor Concatenate(const XList &smalls, int dim);
void
_Concatenate
(
const
XTensor
*
smallA
,
const
XTensor
*
smallB
,
XTensor
*
big
,
int
dim
);
void
_Concatenate
(
const
XTensor
*
smallA
,
const
XTensor
*
smallB
,
XTensor
*
big
,
int
dim
);
/*
/*
concatenate two tensors along a given dimension (return a XTensor structure)
concatenate two tensors along a given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
XTensor
Concatenate
(
const
XTensor
&
smallA
,
const
XTensor
&
smallB
,
int
dim
);
XTensor
Concatenate
(
const
XTensor
&
smallA
,
const
XTensor
&
smallB
,
int
dim
);
...
...
source/tensor/core/shape/Merge.cpp
查看文件 @
78954fad
...
@@ -149,7 +149,7 @@ void _Merge(const XTensor * s, XTensor * t, int whereToMerge, int leadingDim)
...
@@ -149,7 +149,7 @@ void _Merge(const XTensor * s, XTensor * t, int whereToMerge, int leadingDim)
}
}
/*
/*
transform a tensor by merging it along with a dimension (return a XTensor structure)
transform a tensor by merging it along with a dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
e.g., (N/3, M, 3) -> (N, M)
e.g., (N/3, M, 3) -> (N, M)
...
@@ -315,7 +315,7 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
...
@@ -315,7 +315,7 @@ void _Merge(const XList * smalls, XTensor * big, int whereToMerge)
}
}
/*
/*
merge small tensors into a big tensor (return a XTensor structure)
merge small tensors into a big tensor (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> smalls - the list of the small tensors
>> smalls - the list of the small tensors
...
@@ -352,7 +352,7 @@ XTensor Merge(const XList &smalls, int whereToMerge)
...
@@ -352,7 +352,7 @@ XTensor Merge(const XList &smalls, int whereToMerge)
}
}
/*
/*
merge two tensors into a big tensor (return a XTensor structure)
merge two tensors into a big tensor (return a
n
XTensor structure)
>> smalls - the list of the small tensors
>> smalls - the list of the small tensors
>> whereToMerge - the merging operation is along with which dimension
>> whereToMerge - the merging operation is along with which dimension
<< return - the big tensor merged by small tensors
<< return - the big tensor merged by small tensors
...
...
source/tensor/core/shape/Merge.h
查看文件 @
78954fad
...
@@ -29,17 +29,17 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
...
@@ -29,17 +29,17 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* transform a tensor by merging it alone with a dimension, e.g., (M, N/3, 3) -> (M, N) */
/* transform a tensor by merging it alone with a dimension, e.g., (M, N/3, 3) -> (M, N) */
void
_Merge
(
const
XTensor
*
s
,
XTensor
*
t
,
int
whereToMerge
,
int
leadingDim
=
-
1
);
void
_Merge
(
const
XTensor
*
s
,
XTensor
*
t
,
int
whereToMerge
,
int
leadingDim
=
-
1
);
/* transform a tensor by merging it alone with a dimension (return a XTensor structure)
/* transform a tensor by merging it alone with a dimension (return a
n
XTensor structure)
e.g., (M, N/3, 3) -> (M, N) */
e.g., (M, N/3, 3) -> (M, N) */
XTensor
Merge
(
const
XTensor
&
s
,
int
whereToMerge
,
int
leadingDim
=
-
1
);
XTensor
Merge
(
const
XTensor
&
s
,
int
whereToMerge
,
int
leadingDim
=
-
1
);
/* merge small tensors into a big tensor */
/* merge small tensors into a big tensor */
void
_Merge
(
const
XList
*
smalls
,
XTensor
*
big
,
int
whereToMerge
);
void
_Merge
(
const
XList
*
smalls
,
XTensor
*
big
,
int
whereToMerge
);
/* merge small tensors into a big tensor (return a XTensor structure) */
/* merge small tensors into a big tensor (return a
n
XTensor structure) */
XTensor
Merge
(
const
XList
&
smalls
,
int
whereToMerge
);
XTensor
Merge
(
const
XList
&
smalls
,
int
whereToMerge
);
/* merge two tensors into a big tensor (return a XTensor structure) */
/* merge two tensors into a big tensor (return a
n
XTensor structure) */
XTensor
Merge
(
const
XTensor
&
smallA
,
const
XTensor
&
smallB
,
int
whereToMerge
);
XTensor
Merge
(
const
XTensor
&
smallA
,
const
XTensor
&
smallB
,
int
whereToMerge
);
}
// namespace nts(NiuTrans.Tensor)
}
// namespace nts(NiuTrans.Tensor)
...
...
source/tensor/core/shape/Permute.h
查看文件 @
78954fad
...
@@ -42,7 +42,7 @@ a = permuted(a)
...
@@ -42,7 +42,7 @@ a = permuted(a)
void
_PermuteMe
(
XTensor
*
a
,
int
*
dimPermute
);
void
_PermuteMe
(
XTensor
*
a
,
int
*
dimPermute
);
/*
/*
make a tensor with permuted dimensions (return a XTensor structure).
make a tensor with permuted dimensions (return a
n
XTensor structure).
make a new tensor to keep the result and return it.
make a new tensor to keep the result and return it.
b = permuted(a)
b = permuted(a)
*/
*/
...
...
source/tensor/core/shape/Split.cpp
查看文件 @
78954fad
...
@@ -157,7 +157,7 @@ void _Split(const XTensor * s, XTensor * t, int whereToSplit, int splitNum)
...
@@ -157,7 +157,7 @@ void _Split(const XTensor * s, XTensor * t, int whereToSplit, int splitNum)
}
}
/*
/*
transform a tensor by splitting it, e.g., (N, M) -> (N/3, M, 3) (return a XTensor structure)
transform a tensor by splitting it, e.g., (N, M) -> (N/3, M, 3) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> s - the source tensor
>> s - the source tensor
...
...
source/tensor/core/shape/Split.h
查看文件 @
78954fad
...
@@ -35,7 +35,7 @@ e.g., (M, N) -> (M, N/3, 3)
...
@@ -35,7 +35,7 @@ e.g., (M, N) -> (M, N/3, 3)
void
_Split
(
const
XTensor
*
s
,
XTensor
*
t
,
int
whereToSplit
,
int
splitNum
);
void
_Split
(
const
XTensor
*
s
,
XTensor
*
t
,
int
whereToSplit
,
int
splitNum
);
/*
/*
transform a tensor by splitting it (return a XTensor structure)
transform a tensor by splitting it (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
e.g., (M, N) -> (M, N/3, 3)
e.g., (M, N) -> (M, N/3, 3)
*/
*/
...
...
source/tensor/core/shape/Squeeze.cpp
查看文件 @
78954fad
...
@@ -89,7 +89,7 @@ void _SqueezeMe(XTensor * source, int leadingDim)
...
@@ -89,7 +89,7 @@ void _SqueezeMe(XTensor * source, int leadingDim)
}
}
/*
/*
squeeze the tensor along the specified dimension (return a XTensor structure)
squeeze the tensor along the specified dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> source - the input tensor
>> source - the input tensor
...
...
source/tensor/core/shape/Squeeze.h
查看文件 @
78954fad
...
@@ -33,7 +33,7 @@ void _Squeeze(XTensor * source, XTensor * target, int leadingDim = -1);
...
@@ -33,7 +33,7 @@ void _Squeeze(XTensor * source, XTensor * target, int leadingDim = -1);
keep the result in the input tensor a and return nothing */
keep the result in the input tensor a and return nothing */
void
_SqueezeMe
(
XTensor
*
source
,
int
leadingDim
=
-
1
);
void
_SqueezeMe
(
XTensor
*
source
,
int
leadingDim
=
-
1
);
/* squeeze the tensor along the specified dimension (return a XTensor structure)
/* squeeze the tensor along the specified dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Squeeze
(
XTensor
&
source
,
int
leadingDim
=
-
1
);
XTensor
Squeeze
(
XTensor
&
source
,
int
leadingDim
=
-
1
);
...
...
source/tensor/core/shape/Transpose.cpp
查看文件 @
78954fad
...
@@ -107,7 +107,7 @@ void _Transpose(const XTensor * a, XTensor * b, const int i, const int j)
...
@@ -107,7 +107,7 @@ void _Transpose(const XTensor * a, XTensor * b, const int i, const int j)
}
}
/*
/*
tensor transposition of dimensions i and j (return a XTensor structure).
tensor transposition of dimensions i and j (return a
n
XTensor structure).
make a new tensor to keep the result and return it.
make a new tensor to keep the result and return it.
b = transposed(a)
b = transposed(a)
...
...
source/tensor/core/shape/Transpose.h
查看文件 @
78954fad
...
@@ -34,7 +34,7 @@ b = transposed(a)
...
@@ -34,7 +34,7 @@ b = transposed(a)
void
_Transpose
(
const
XTensor
*
a
,
XTensor
*
b
,
const
int
i
,
const
int
j
);
void
_Transpose
(
const
XTensor
*
a
,
XTensor
*
b
,
const
int
i
,
const
int
j
);
/*
/*
tensor transposition of dimensions i and j (return a XTensor structure).
tensor transposition of dimensions i and j (return a
n
XTensor structure).
make a new tensor to keep the result and return it.
make a new tensor to keep the result and return it.
b = transposed(a)
b = transposed(a)
*/
*/
...
...
source/tensor/core/shape/Unsqueeze.h
查看文件 @
78954fad
...
@@ -31,7 +31,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
...
@@ -31,7 +31,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
void
_Unsqueeze
(
const
XTensor
*
a
,
XTensor
*
b
,
int
dim
,
int
dSize
);
void
_Unsqueeze
(
const
XTensor
*
a
,
XTensor
*
b
,
int
dim
,
int
dSize
);
/* insert a dimension by copying the blocks for x times
/* insert a dimension by copying the blocks for x times
(where x is the size of the inerted dimension) (return a XTensor structure)
(where x is the size of the inerted dimension) (return a
n
XTensor structure)
make a new tensor to keep the result and return it */
make a new tensor to keep the result and return it */
XTensor
Unsqueeze
(
const
XTensor
&
a
,
int
dim
,
int
dSize
);
XTensor
Unsqueeze
(
const
XTensor
&
a
,
int
dim
,
int
dSize
);
...
...
source/tensor/core/sort/Sort.cpp
查看文件 @
78954fad
...
@@ -95,7 +95,7 @@ void _SortMe(XTensor * a, XTensor * index, int dim)
...
@@ -95,7 +95,7 @@ void _SortMe(XTensor * a, XTensor * index, int dim)
}
}
/*
/*
sort the tensor along a given dimension (return a XTensor structure)
sort the tensor along a given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> a - input tensor
>> a - input tensor
...
...
source/tensor/core/sort/Sort.h
查看文件 @
78954fad
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
...
@@ -36,7 +36,7 @@ keep the result in the input tensor a and return nothing
void
_SortMe
(
XTensor
*
a
,
XTensor
*
index
,
int
dim
);
void
_SortMe
(
XTensor
*
a
,
XTensor
*
index
,
int
dim
);
/*
/*
sort the data along a given dimension (return a XTensor structure)
sort the data along a given dimension (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
*/
*/
void
Sort
(
XTensor
&
a
,
XTensor
&
b
,
XTensor
&
index
,
int
dim
);
void
Sort
(
XTensor
&
a
,
XTensor
&
b
,
XTensor
&
index
,
int
dim
);
...
...
source/tensor/function/HardTanH.cpp
查看文件 @
78954fad
...
@@ -61,7 +61,7 @@ void _HardTanH(const XTensor * x, XTensor * y)
...
@@ -61,7 +61,7 @@ void _HardTanH(const XTensor * x, XTensor * y)
}
}
/*
/*
hard tanh function (return a XTensor structure)
hard tanh function (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
y = 1 if x > 1
y = 1 if x > 1
...
...
source/tensor/function/HardTanH.h
查看文件 @
78954fad
...
@@ -37,7 +37,7 @@ y = 1 if x > 1
...
@@ -37,7 +37,7 @@ y = 1 if x > 1
*/
*/
void
_HardTanH
(
const
XTensor
*
x
,
XTensor
*
y
);
void
_HardTanH
(
const
XTensor
*
x
,
XTensor
*
y
);
/* hard tanh function (return a XTensor structure) */
/* hard tanh function (return a
n
XTensor structure) */
XTensor
HardTanH
(
const
XTensor
&
x
);
XTensor
HardTanH
(
const
XTensor
&
x
);
/* de/dx */
/* de/dx */
...
...
source/tensor/function/Identity.cpp
查看文件 @
78954fad
...
@@ -38,7 +38,7 @@ void _Identity(const XTensor * x, XTensor * y)
...
@@ -38,7 +38,7 @@ void _Identity(const XTensor * x, XTensor * y)
}
}
/*
/*
identity function y = x (return a XTensor structure)
identity function y = x (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> x - input tensor
>> x - input tensor
...
...
source/tensor/function/Identity.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* identity function y = x */
/* identity function y = x */
void
_Identity
(
const
XTensor
*
x
,
XTensor
*
y
);
void
_Identity
(
const
XTensor
*
x
,
XTensor
*
y
);
/* identity function y = x (return a XTensor structure) */
/* identity function y = x (return a
n
XTensor structure) */
XTensor
Identity
(
const
XTensor
&
x
);
XTensor
Identity
(
const
XTensor
&
x
);
/* de/dx */
/* de/dx */
...
...
source/tensor/function/LogSoftmax.cpp
查看文件 @
78954fad
...
@@ -168,7 +168,7 @@ void _LogSoftmax(const XTensor * x, XTensor * y, int leadDim)
...
@@ -168,7 +168,7 @@ void _LogSoftmax(const XTensor * x, XTensor * y, int leadDim)
}
}
/*
/*
log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (return a XTensor structure)
log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> x - input vector
>> x - input vector
...
...
source/tensor/function/LogSoftmax.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) */
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) */
void
_LogSoftmax
(
const
XTensor
*
x
,
XTensor
*
y
,
int
leadDim
);
void
_LogSoftmax
(
const
XTensor
*
x
,
XTensor
*
y
,
int
leadDim
);
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (return a XTensor structure) */
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (return a
n
XTensor structure) */
XTensor
LogSoftmax
(
const
XTensor
&
x
,
int
leadDim
);
XTensor
LogSoftmax
(
const
XTensor
&
x
,
int
leadDim
);
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (with both argument of x and y) */
/* log scale softmax y = log(e^x / \sum_{i} e^{x_i}) (with both argument of x and y) */
...
...
source/tensor/function/Rectify.cpp
查看文件 @
78954fad
...
@@ -57,7 +57,7 @@ void _Rectify(const XTensor * x, XTensor * y)
...
@@ -57,7 +57,7 @@ void _Rectify(const XTensor * x, XTensor * y)
}
}
/*
/*
rectify function y = max(0, x) (return a XTensor structure)
rectify function y = max(0, x) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> input - input tensor
>> input - input tensor
...
...
source/tensor/function/Rectify.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* rectify function y = max(0, x) */
/* rectify function y = max(0, x) */
void
_Rectify
(
const
XTensor
*
x
,
XTensor
*
y
);
void
_Rectify
(
const
XTensor
*
x
,
XTensor
*
y
);
/* rectify function y = max(0, x) (return a XTensor structure) */
/* rectify function y = max(0, x) (return a
n
XTensor structure) */
XTensor
Rectify
(
const
XTensor
&
x
);
XTensor
Rectify
(
const
XTensor
&
x
);
/* de/dx */
/* de/dx */
...
...
source/tensor/function/Sigmoid.cpp
查看文件 @
78954fad
...
@@ -55,7 +55,7 @@ void _Sigmoid(const XTensor * x, XTensor * y)
...
@@ -55,7 +55,7 @@ void _Sigmoid(const XTensor * x, XTensor * y)
}
}
/*
/*
sigmoid function y = 1/(1+exp(-x)) (return a XTensor structure)
sigmoid function y = 1/(1+exp(-x)) (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> x - input tensor
>> x - input tensor
...
...
source/tensor/function/Sigmoid.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* sigmoid function y = 1/(1+exp(-x)) */
/* sigmoid function y = 1/(1+exp(-x)) */
void
_Sigmoid
(
const
XTensor
*
x
,
XTensor
*
y
);
void
_Sigmoid
(
const
XTensor
*
x
,
XTensor
*
y
);
/* sigmoid function y = 1/(1+exp(-x)) (return a XTensor structure) */
/* sigmoid function y = 1/(1+exp(-x)) (return a
n
XTensor structure) */
XTensor
Sigmoid
(
const
XTensor
&
x
);
XTensor
Sigmoid
(
const
XTensor
&
x
);
/* de/dx */
/* de/dx */
...
...
source/tensor/function/Softmax.cpp
查看文件 @
78954fad
...
@@ -122,7 +122,7 @@ void _Softmax(const XTensor * x, XTensor * y, int leadDim)
...
@@ -122,7 +122,7 @@ void _Softmax(const XTensor * x, XTensor * y, int leadDim)
}
}
/*
/*
softmax y = e^x / \sum_{i} e^{x_i} (return a XTensor structure)
softmax y = e^x / \sum_{i} e^{x_i} (return a
n
XTensor structure)
make a new tensor to keep the result and return it
make a new tensor to keep the result and return it
>> x - input vector
>> x - input vector
...
...
source/tensor/function/Softmax.h
查看文件 @
78954fad
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
...
@@ -30,7 +30,7 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* softmax y = e^x / \sum_{i} e^{x_i} */
/* softmax y = e^x / \sum_{i} e^{x_i} */
void
_Softmax
(
const
XTensor
*
x
,
XTensor
*
y
,
int
leadDim
);
void
_Softmax
(
const
XTensor
*
x
,
XTensor
*
y
,
int
leadDim
);
/* softmax y = e^x / \sum_{i} e^{x_i} (return a XTensor structure) */
/* softmax y = e^x / \sum_{i} e^{x_i} (return a
n
XTensor structure) */
XTensor
Softmax
(
const
XTensor
&
x
,
int
leadDim
);
XTensor
Softmax
(
const
XTensor
&
x
,
int
leadDim
);
/* de/dx */
/* de/dx */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论