Commit 876c85c0 by ltb

add a macro GETANDSET_CONVERTDATATYPE which is used in ConvertDataType

parent 953421c3
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* /*
* $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-05 * $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-05
*/ */
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
namespace nts { // namespace nts(NiuTrans.Tensor) namespace nts { // namespace nts(NiuTrans.Tensor)
/* get operator name */ /* get operator name */
const char * GetOPName(int type) const char * GetOPName(int type)
{ {
if ((type & MATH_BASE) != 0){ if ((type & MATH_BASE) != 0) {
if (type == MATH_ABSOLUTE) if (type == MATH_ABSOLUTE)
return "M_ABSOLUTE"; return "M_ABSOLUTE";
else if (type == MATH_CEIL) else if (type == MATH_CEIL)
...@@ -109,13 +109,7 @@ const char * GetOPName(int type) ...@@ -109,13 +109,7 @@ const char * GetOPName(int type)
return "R_REDUCEVARIANCE"; return "R_REDUCEVARIANCE";
} }
else if ((type & DATA_BASE) != 0) { else if ((type & DATA_BASE) != 0) {
if (type == GETANDSET_CONVERTDATATYPE) if (type == GETANDSET_SELECT)
return "G_CONVERTDATATYPE";
else if (type == GETANDSET_INDEXTOONEHOT)
return "G_INDEXTOONEHOT";
else if (type == GETANDSET_ONEHOTTOINDEX)
return "G_ONEHOTTOINDEX";
else if (type == GETANDSET_SELECT)
return "G_SELECT"; return "G_SELECT";
else if (type == MOVEMENT_COPYINDEXED) else if (type == MOVEMENT_COPYINDEXED)
return "M_COPYINDEXED"; return "M_COPYINDEXED";
...@@ -150,7 +144,7 @@ const char * GetOPName(int type) ...@@ -150,7 +144,7 @@ const char * GetOPName(int type)
else if (type == SORT_TOPK) else if (type == SORT_TOPK)
return "S_TOPK"; return "S_TOPK";
} }
else if ((type & FUNCTION_BASE) != 0){ else if ((type & FUNCTION_BASE) != 0) {
if (type == FUNC_DROPOUT) if (type == FUNC_DROPOUT)
return "F_DROPOUT"; return "F_DROPOUT";
else if (type == FUNC_HARDTANH) else if (type == FUNC_HARDTANH)
...@@ -172,7 +166,7 @@ const char * GetOPName(int type) ...@@ -172,7 +166,7 @@ const char * GetOPName(int type)
} }
return "NULL"; return "NULL";
} }
} // namespace nts(NiuTrans.Tensor) } // namespace nts(NiuTrans.Tensor)
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
/* /*
* *
* We define various names here * We define various names here
* *
* $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-05 * $Created by: XIAO Tong (xiaotong@mail.neu.edu.cn) 2018-07-05
* It was really HOT these days. I can't imagine it is SO hot here in Shenyang! * It was really HOT these days. I can't imagine it is SO hot here in Shenyang!
*/ */
#ifndef __XNAME_H__ #ifndef __XNAME_H__
#define __XNAME_H__ #define __XNAME_H__
...@@ -31,6 +31,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor) ...@@ -31,6 +31,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* math operations */ /* math operations */
#define MATH_BASE 0x00001000 #define MATH_BASE 0x00001000
#define GETANDSET_CONVERTDATATYPE MATH_BASE * 8
#define MATH_ABSOLUTE MATH_BASE + 1 #define MATH_ABSOLUTE MATH_BASE + 1
#define MATH_CEIL MATH_ABSOLUTE + 1 #define MATH_CEIL MATH_ABSOLUTE + 1
#define MATH_EXP MATH_CEIL + 1 #define MATH_EXP MATH_CEIL + 1
...@@ -79,13 +80,9 @@ namespace nts { // namespace nts(NiuTrans.Tensor) ...@@ -79,13 +80,9 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* data and shape related operations */ /* data and shape related operations */
#define DATA_BASE MATH_BASE * 2 #define DATA_BASE MATH_BASE * 2
#define GETANDSET DATA_BASE + 1 #define GETANDSET DATA_BASE + 1
#define GETANDSET_CONVERTDATATYPE GETANDSET + 1 #define GETANDSET_SELECT GETANDSET + 1
#define GETANDSET_INDEXTOONEHOT GETANDSET_CONVERTDATATYPE + 1
#define GETANDSET_ONEHOTTOINDEX GETANDSET_INDEXTOONEHOT + 1
#define GETANDSET_SELECT GETANDSET_ONEHOTTOINDEX + 1
#define SHAPE_BASE DATA_BASE * 2 #define MOVEMENT GETANDSET_SELECT + 1
#define MOVEMENT SHAPE_BASE + 1
#define MOVEMENT_COPYINDEXED MOVEMENT + 1 #define MOVEMENT_COPYINDEXED MOVEMENT + 1
#define MOVEMENT_COPYVALUES MOVEMENT_COPYINDEXED + 1 #define MOVEMENT_COPYVALUES MOVEMENT_COPYINDEXED + 1
#define MOVEMENT_GATHER MOVEMENT_COPYVALUES + 1 #define MOVEMENT_GATHER MOVEMENT_COPYVALUES + 1
...@@ -108,7 +105,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor) ...@@ -108,7 +105,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
#define SORT_TOPK SORT_SORT + 1 #define SORT_TOPK SORT_SORT + 1
/* activation functions */ /* activation functions */
#define FUNCTION_BASE SHAPE_BASE * 2 #define FUNCTION_BASE DATA_BASE * 2
#define FUNC_DROPOUT FUNCTION_BASE + 1 #define FUNC_DROPOUT FUNCTION_BASE + 1
#define FUNC_HARDTANH FUNC_DROPOUT + 1 #define FUNC_HARDTANH FUNC_DROPOUT + 1
#define FUNC_IDENTITY FUNC_HARDTANH + 1 #define FUNC_IDENTITY FUNC_HARDTANH + 1
...@@ -121,7 +118,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor) ...@@ -121,7 +118,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
#define LOSS_CROSSENTROPY LOSS_BASE + 1 #define LOSS_CROSSENTROPY LOSS_BASE + 1
/* get operator name */ /* get operator name */
const char * GetOPName(int type); const char * GetOPName(int type);
} // namespace nts(NiuTrans.Tensor) } // namespace nts(NiuTrans.Tensor)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论