Commit 78954fad by xiaotong

revise the comment

parent dc56fd67
...@@ -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 an 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)
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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.
......
...@@ -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 an 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.
......
...@@ -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 an 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 an 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
......
...@@ -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 an 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)
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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)
......
...@@ -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 an 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)
*/ */
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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.
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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)
......
...@@ -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 an 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);
......
...@@ -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 an 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,
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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
*/ */
......
...@@ -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 an 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 an 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,
......
...@@ -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.0F, bool isExp = false); DTYPE power = (DTYPE)1.0F, 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 an 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.0F, bool isExp = false); XTensor ReduceSum(const XTensor &input, int dim, const XTensor &shift, DTYPE power = (DTYPE)1.0F, 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 an 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
......
...@@ -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 an 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
......
...@@ -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 an 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
*/ */
......
...@@ -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 an 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
......
...@@ -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 an 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
*/ */
......
...@@ -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 an 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 an 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
......
...@@ -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 an 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 an 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);
......
...@@ -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 an 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 an 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 an 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
......
...@@ -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 an 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 an 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 an 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)
......
...@@ -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 an 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)
*/ */
......
...@@ -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 an 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
......
...@@ -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 an 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)
*/ */
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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)
......
...@@ -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 an 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)
*/ */
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an 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);
......
...@@ -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 an 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
......
...@@ -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 an XTensor structure) */
XTensor HardTanH(const XTensor &x); XTensor HardTanH(const XTensor &x);
/* de/dx */ /* de/dx */
......
...@@ -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 an 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
......
...@@ -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 an XTensor structure) */
XTensor Identity(const XTensor &x); XTensor Identity(const XTensor &x);
/* de/dx */ /* de/dx */
......
...@@ -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 an 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
......
...@@ -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 an 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) */
......
...@@ -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 an 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
......
...@@ -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 an XTensor structure) */
XTensor Rectify(const XTensor &x); XTensor Rectify(const XTensor &x);
/* de/dx */ /* de/dx */
......
...@@ -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 an 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
......
...@@ -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 an XTensor structure) */
XTensor Sigmoid(const XTensor &x); XTensor Sigmoid(const XTensor &x);
/* de/dx */ /* de/dx */
......
...@@ -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 an 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
......
...@@ -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 an XTensor structure) */
XTensor Softmax(const XTensor &x, int leadDim); XTensor Softmax(const XTensor &x, int leadDim);
/* de/dx */ /* de/dx */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论