Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Tensor.LowPrecision
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
linye
Tensor.LowPrecision
Commits
75d9a0f5
Commit
75d9a0f5
authored
Jul 29, 2019
by
ltb
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "add a macro GETANDSET_CONVERTDATATYPE which is used in ConvertDataType"
This reverts commit
876c85c0
.
parent
876c85c0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
170 行增加
和
161 行删除
+170
-161
source/tensor/XName.cpp
+154
-148
source/tensor/XName.h
+16
-13
没有找到文件。
source/tensor/XName.cpp
查看文件 @
75d9a0f5
...
...
@@ -15,158 +15,164 @@
* 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
*/
#include "XName.h"
namespace
nts
{
// namespace nts(NiuTrans.Tensor)
/* get operator name */
const
char
*
GetOPName
(
int
type
)
{
if
((
type
&
MATH_BASE
)
!=
0
)
{
if
(
type
==
MATH_ABSOLUTE
)
return
"M_ABSOLUTE"
;
else
if
(
type
==
MATH_CEIL
)
return
"M_CEIL"
;
else
if
(
type
==
MATH_EXP
)
return
"M_EXP"
;
else
if
(
type
==
MATH_FLOOR
)
return
"M_FLOOR"
;
else
if
(
type
==
MATH_ISNONZERO
)
return
"M_ISNONZERO"
;
else
if
(
type
==
MATH_ISZERO
)
return
"M_ISZERO"
;
else
if
(
type
==
MATH_LOG
)
return
"M_LOG"
;
else
if
(
type
==
MATH_SQRT
)
return
"M_SQRT"
;
else
if
(
type
==
MATH_SQUARE
)
return
"M_SQUARE"
;
else
if
(
type
==
MATH_SIN
)
return
"M_SIN"
;
else
if
(
type
==
MATH_COS
)
return
"M_COS"
;
else
if
(
type
==
MATH_TAN
)
return
"M_TAN"
;
else
if
(
type
==
MATH_ROUND
)
return
"M_ROUND"
;
else
if
(
type
==
MATH_CLIP
)
return
"M_CLIP"
;
else
if
(
type
==
MATH_DIV
)
return
"M_DIV"
;
else
if
(
type
==
MATH_DIVDIM
)
return
"M_DIVDIM"
;
else
if
(
type
==
MATH_MATRIXMUL
)
return
"M_MATRIXMUL"
;
else
if
(
type
==
MATH_MATRIXMULBATCHED
)
return
"M_MATRIXMULBATCHED"
;
else
if
(
type
==
MATH_MULTIPLY
)
return
"M_MULTIPLY"
;
else
if
(
type
==
MATH_MULTIPLYDIM
)
return
"M_MULTIPLYDIM"
;
else
if
(
type
==
MATH_MULTIPLYBROADCAST
)
return
"M_MULTIPLYBROADCAST"
;
else
if
(
type
==
MATH_NEGATE
)
return
"M_NEGATE"
;
else
if
(
type
==
MATH_NORMALIZE
)
return
"M_NORMALIZE"
;
else
if
(
type
==
MATH_POWER
)
return
"M_POWER"
;
else
if
(
type
==
MATH_SCALEANDSHIFT
)
return
"M_SCALEANDSHIFT"
;
else
if
(
type
==
MATH_SCALE
)
return
"M_SCALE"
;
else
if
(
type
==
MATH_DESCALE
)
return
"M_DESCALE"
;
else
if
(
type
==
MATH_SHIFT
)
return
"M_SHIFT"
;
else
if
(
type
==
MATH_MULANDSHIFT
)
return
"M_OPERATION"
;
else
if
(
type
==
MATH_SIGN
)
return
"M_SIGN"
;
else
if
(
type
==
MATH_SUB
)
return
"M_SUB"
;
else
if
(
type
==
MATH_SUBDIM
)
return
"M_SUBDIM"
;
else
if
(
type
==
MATH_SUM
)
return
"M_SUM"
;
else
if
(
type
==
MATH_SUMDIM
)
return
"M_SUMDIM"
;
else
if
(
type
==
MATH_SUMBROADCAST
)
return
"M_SUMBROADCAST"
;
else
if
(
type
==
REDUCE_REDUCEMAX
)
return
"R_REDUCEMAX"
;
else
if
(
type
==
REDUCE_REDUCEMEAN
)
return
"R_REDUCEMEAN"
;
else
if
(
type
==
REDUCE_REDUCESUM
)
return
"R_REDUCESUM"
;
else
if
(
type
==
REDUCE_REDUCESUMSQUARED
)
return
"R_REDUCESUMSQUARED"
;
else
if
(
type
==
REDUCE_REDUCEVARIANCE
)
return
"R_REDUCEVARIANCE"
;
}
else
if
((
type
&
DATA_BASE
)
!=
0
)
{
if
(
type
==
GETANDSET_SELECT
)
return
"G_SELECT"
;
else
if
(
type
==
MOVEMENT_COPYINDEXED
)
return
"M_COPYINDEXED"
;
else
if
(
type
==
MOVEMENT_COPYVALUES
)
return
"M_COPYVALUES"
;
else
if
(
type
==
MOVEMENT_GATHER
)
return
"M_GATHER"
;
else
if
(
type
==
MOVEMENT_DROPOUTWITHINDEX
)
return
"M_DROPOUTWITHINDEX"
;
else
if
(
type
==
SHAPE_CONCATENATE
)
return
"S_CONCATENATE"
;
else
if
(
type
==
SHAPE_MERGE
)
return
"S_MERGE"
;
else
if
(
type
==
SHAPE_MERGE_LIST
)
return
"S_MERGE_LIST"
;
else
if
(
type
==
SHAPE_PERMUTE
)
return
"S_PERMUTE"
;
else
if
(
type
==
SHAPE_RESHAPE
)
return
"S_RESHAPE"
;
else
if
(
type
==
SHAPE_SPLIT
)
return
"S_SPLIT"
;
else
if
(
type
==
SHAPE_SPLIT_LIST
)
return
"S_SPLIT_LIST"
;
else
if
(
type
==
SHAPE_SQUEEZE
)
return
"S_SQUEEZE"
;
else
if
(
type
==
SHAPE_TRANSPOSE
)
return
"S_TRANSPOSE"
;
else
if
(
type
==
SHAPE_UNSQUEEZE
)
return
"S_UNSQUEEZE"
;
else
if
(
type
==
SORT_SORT
)
return
"S_SORT"
;
else
if
(
type
==
SORT_TOPK
)
return
"S_TOPK"
;
}
else
if
((
type
&
FUNCTION_BASE
)
!=
0
)
{
if
(
type
==
FUNC_DROPOUT
)
return
"F_DROPOUT"
;
else
if
(
type
==
FUNC_HARDTANH
)
return
"F_HARDTANH"
;
else
if
(
type
==
FUNC_IDENTITY
)
return
"F_IDENTITY"
;
else
if
(
type
==
FUNC_LOGSOFTMAX
)
return
"F_LOGSOFTMAX"
;
else
if
(
type
==
FUNC_RECTIFY
)
return
"F_RECTIFY"
;
else
if
(
type
==
FUNC_SIGMOID
)
return
"F_SIGMOID"
;
else
if
(
type
==
FUNC_SOFTMAX
)
return
"F_SOFTMAX"
;
}
else
if
((
type
&
LOSS_BASE
)
!=
0
)
{
if
(
type
==
LOSS_CROSSENTROPY
)
return
"L_CROSSENTROPY"
;
}
return
"NULL"
;
}
const
char
*
GetOPName
(
int
type
)
{
if
((
type
&
MATH_BASE
)
!=
0
){
if
(
type
==
MATH_ABSOLUTE
)
return
"M_ABSOLUTE"
;
else
if
(
type
==
MATH_CEIL
)
return
"M_CEIL"
;
else
if
(
type
==
MATH_EXP
)
return
"M_EXP"
;
else
if
(
type
==
MATH_FLOOR
)
return
"M_FLOOR"
;
else
if
(
type
==
MATH_ISNONZERO
)
return
"M_ISNONZERO"
;
else
if
(
type
==
MATH_ISZERO
)
return
"M_ISZERO"
;
else
if
(
type
==
MATH_LOG
)
return
"M_LOG"
;
else
if
(
type
==
MATH_SQRT
)
return
"M_SQRT"
;
else
if
(
type
==
MATH_SQUARE
)
return
"M_SQUARE"
;
else
if
(
type
==
MATH_SIN
)
return
"M_SIN"
;
else
if
(
type
==
MATH_COS
)
return
"M_COS"
;
else
if
(
type
==
MATH_TAN
)
return
"M_TAN"
;
else
if
(
type
==
MATH_ROUND
)
return
"M_ROUND"
;
else
if
(
type
==
MATH_CLIP
)
return
"M_CLIP"
;
else
if
(
type
==
MATH_DIV
)
return
"M_DIV"
;
else
if
(
type
==
MATH_DIVDIM
)
return
"M_DIVDIM"
;
else
if
(
type
==
MATH_MATRIXMUL
)
return
"M_MATRIXMUL"
;
else
if
(
type
==
MATH_MATRIXMULBATCHED
)
return
"M_MATRIXMULBATCHED"
;
else
if
(
type
==
MATH_MULTIPLY
)
return
"M_MULTIPLY"
;
else
if
(
type
==
MATH_MULTIPLYDIM
)
return
"M_MULTIPLYDIM"
;
else
if
(
type
==
MATH_MULTIPLYBROADCAST
)
return
"M_MULTIPLYBROADCAST"
;
else
if
(
type
==
MATH_NEGATE
)
return
"M_NEGATE"
;
else
if
(
type
==
MATH_NORMALIZE
)
return
"M_NORMALIZE"
;
else
if
(
type
==
MATH_POWER
)
return
"M_POWER"
;
else
if
(
type
==
MATH_SCALEANDSHIFT
)
return
"M_SCALEANDSHIFT"
;
else
if
(
type
==
MATH_SCALE
)
return
"M_SCALE"
;
else
if
(
type
==
MATH_DESCALE
)
return
"M_DESCALE"
;
else
if
(
type
==
MATH_SHIFT
)
return
"M_SHIFT"
;
else
if
(
type
==
MATH_MULANDSHIFT
)
return
"M_OPERATION"
;
else
if
(
type
==
MATH_SIGN
)
return
"M_SIGN"
;
else
if
(
type
==
MATH_SUB
)
return
"M_SUB"
;
else
if
(
type
==
MATH_SUBDIM
)
return
"M_SUBDIM"
;
else
if
(
type
==
MATH_SUM
)
return
"M_SUM"
;
else
if
(
type
==
MATH_SUMDIM
)
return
"M_SUMDIM"
;
else
if
(
type
==
MATH_SUMBROADCAST
)
return
"M_SUMBROADCAST"
;
else
if
(
type
==
REDUCE_REDUCEMAX
)
return
"R_REDUCEMAX"
;
else
if
(
type
==
REDUCE_REDUCEMEAN
)
return
"R_REDUCEMEAN"
;
else
if
(
type
==
REDUCE_REDUCESUM
)
return
"R_REDUCESUM"
;
else
if
(
type
==
REDUCE_REDUCESUMSQUARED
)
return
"R_REDUCESUMSQUARED"
;
else
if
(
type
==
REDUCE_REDUCEVARIANCE
)
return
"R_REDUCEVARIANCE"
;
}
else
if
((
type
&
DATA_BASE
)
!=
0
)
{
if
(
type
==
GETANDSET_CONVERTDATATYPE
)
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"
;
else
if
(
type
==
MOVEMENT_COPYINDEXED
)
return
"M_COPYINDEXED"
;
else
if
(
type
==
MOVEMENT_COPYVALUES
)
return
"M_COPYVALUES"
;
else
if
(
type
==
MOVEMENT_GATHER
)
return
"M_GATHER"
;
else
if
(
type
==
MOVEMENT_DROPOUTWITHINDEX
)
return
"M_DROPOUTWITHINDEX"
;
else
if
(
type
==
SHAPE_CONCATENATE
)
return
"S_CONCATENATE"
;
else
if
(
type
==
SHAPE_MERGE
)
return
"S_MERGE"
;
else
if
(
type
==
SHAPE_MERGE_LIST
)
return
"S_MERGE_LIST"
;
else
if
(
type
==
SHAPE_PERMUTE
)
return
"S_PERMUTE"
;
else
if
(
type
==
SHAPE_RESHAPE
)
return
"S_RESHAPE"
;
else
if
(
type
==
SHAPE_SPLIT
)
return
"S_SPLIT"
;
else
if
(
type
==
SHAPE_SPLIT_LIST
)
return
"S_SPLIT_LIST"
;
else
if
(
type
==
SHAPE_SQUEEZE
)
return
"S_SQUEEZE"
;
else
if
(
type
==
SHAPE_TRANSPOSE
)
return
"S_TRANSPOSE"
;
else
if
(
type
==
SHAPE_UNSQUEEZE
)
return
"S_UNSQUEEZE"
;
else
if
(
type
==
SORT_SORT
)
return
"S_SORT"
;
else
if
(
type
==
SORT_TOPK
)
return
"S_TOPK"
;
}
else
if
((
type
&
FUNCTION_BASE
)
!=
0
){
if
(
type
==
FUNC_DROPOUT
)
return
"F_DROPOUT"
;
else
if
(
type
==
FUNC_HARDTANH
)
return
"F_HARDTANH"
;
else
if
(
type
==
FUNC_IDENTITY
)
return
"F_IDENTITY"
;
else
if
(
type
==
FUNC_LOGSOFTMAX
)
return
"F_LOGSOFTMAX"
;
else
if
(
type
==
FUNC_RECTIFY
)
return
"F_RECTIFY"
;
else
if
(
type
==
FUNC_SIGMOID
)
return
"F_SIGMOID"
;
else
if
(
type
==
FUNC_SOFTMAX
)
return
"F_SOFTMAX"
;
}
else
if
((
type
&
LOSS_BASE
)
!=
0
)
{
if
(
type
==
LOSS_CROSSENTROPY
)
return
"L_CROSSENTROPY"
;
}
return
"NULL"
;
}
}
// namespace nts(NiuTrans.Tensor)
source/tensor/XName.h
查看文件 @
75d9a0f5
/* NiuTrans.Tensor - an open-source tensor library
* Copyright (C) 2018, Natural Language Processing Lab, Northestern University.
* Copyright (C) 2018, Natural Language Processing Lab, Northestern University.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -15,13 +15,13 @@
* limitations under the License.
*/
/*
*
* We define various names here
*
* $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!
*/
/*
*
* We define various names here
*
* $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!
*/
#ifndef __XNAME_H__
#define __XNAME_H__
...
...
@@ -31,7 +31,6 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* math operations */
#define MATH_BASE 0x00001000
#define GETANDSET_CONVERTDATATYPE MATH_BASE * 8
#define MATH_ABSOLUTE MATH_BASE + 1
#define MATH_CEIL MATH_ABSOLUTE + 1
#define MATH_EXP MATH_CEIL + 1
...
...
@@ -80,9 +79,13 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
/* data and shape related operations */
#define DATA_BASE MATH_BASE * 2
#define GETANDSET DATA_BASE + 1
#define GETANDSET_SELECT GETANDSET + 1
#define GETANDSET_CONVERTDATATYPE GETANDSET + 1
#define GETANDSET_INDEXTOONEHOT GETANDSET_CONVERTDATATYPE + 1
#define GETANDSET_ONEHOTTOINDEX GETANDSET_INDEXTOONEHOT + 1
#define GETANDSET_SELECT GETANDSET_ONEHOTTOINDEX + 1
#define MOVEMENT GETANDSET_SELECT + 1
#define SHAPE_BASE DATA_BASE * 2
#define MOVEMENT SHAPE_BASE + 1
#define MOVEMENT_COPYINDEXED MOVEMENT + 1
#define MOVEMENT_COPYVALUES MOVEMENT_COPYINDEXED + 1
#define MOVEMENT_GATHER MOVEMENT_COPYVALUES + 1
...
...
@@ -105,7 +108,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
#define SORT_TOPK SORT_SORT + 1
/* activation functions */
#define FUNCTION_BASE
DATA
_BASE * 2
#define FUNCTION_BASE
SHAPE
_BASE * 2
#define FUNC_DROPOUT FUNCTION_BASE + 1
#define FUNC_HARDTANH FUNC_DROPOUT + 1
#define FUNC_IDENTITY FUNC_HARDTANH + 1
...
...
@@ -118,7 +121,7 @@ namespace nts { // namespace nts(NiuTrans.Tensor)
#define LOSS_CROSSENTROPY LOSS_BASE + 1
/* get operator name */
const
char
*
GetOPName
(
int
type
);
const
char
*
GetOPName
(
int
type
);
}
// namespace nts(NiuTrans.Tensor)
...
...
ltb
@ltb
被提及 commit
ccfe71d0
Jul 29, 2019
被提及 commit
ccfe71d0
被提及 commit ccfe71d079bcd562140feffc332c4cd0686453f9
切换提交列表
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论