Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
7066ad5b
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
396
Star
4704
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7066ad5b
编写于
11月 23, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(dnn): add uint16 support
GitOrigin-RevId: f4c4b1c7b9076dd8c4c13b23753d6f1aa5570ae5
上级
a1877ee0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
0 deletion
+16
-0
dnn/include/megdnn/dtype.h
dnn/include/megdnn/dtype.h
+5
-0
dnn/test/common/dtype.cpp
dnn/test/common/dtype.cpp
+1
-0
src/core/include/megbrain/dtype.h
src/core/include/megbrain/dtype.h
+1
-0
src/opr/impl/loop/forward.cpp
src/opr/impl/loop/forward.cpp
+6
-0
src/opr/impl/loop/impl.cpp
src/opr/impl/loop/impl.cpp
+2
-0
src/serialization/impl/dtype.fbs
src/serialization/impl/dtype.fbs
+1
-0
未找到文件。
dnn/include/megdnn/dtype.h
浏览文件 @
7066ad5b
...
...
@@ -53,6 +53,7 @@ namespace megdnn {
MEGDNN_INC_FLOAT16(cb(BFloat16)) \
cb(UintB4) \
cb(Bool) \
cb(Uint16) \
/*!
* \brief iterate through each full byte dtype
...
...
@@ -67,6 +68,7 @@ namespace megdnn {
MEGDNN_INC_FLOAT16(cb(Float16)) \
MEGDNN_INC_FLOAT16(cb(BFloat16)) \
cb(Bool) \
cb(Uint16) \
/*!
* \brief iterate through each fractional byte dtype
...
...
@@ -353,6 +355,7 @@ typedef int16_t dt_int16;
typedef
int8_t
dt_int8
;
typedef
uint8_t
dt_uint8
;
typedef
bool
dt_bool
;
typedef
uint16_t
dt_uint16
;
MEGDNN_INC_FLOAT16
(
typedef
half_float
::
half
dt_float16
;)
MEGDNN_INC_FLOAT16
(
typedef
half_bfloat16
::
bfloat16
dt_bfloat16
;)
...
...
@@ -381,6 +384,7 @@ MEGDNN_INC_FLOAT16(typedef half_bfloat16::bfloat16 dt_bfloat16;)
BFloat16
=
11
,
#endif
Bool
=
12
,
Uint16
=
13
,
#define FST(_name) _name = MEGDNN_PARAMETERIZED_DTYPE_ENUM_BASE,
#define D(_name) _name,
MEGDNN_FOREACH_PARAMETERIZED_DTYPE_2
(
FST
,
D
)
...
...
@@ -713,6 +717,7 @@ MEGDNN_DEF_DT(Int16, dt_int16, INT, SIGNED, INT16_MIN, INT16_MAX);
MEGDNN_DEF_DT
(
Int8
,
dt_int8
,
INT
,
SIGNED
,
INT8_MIN
,
INT8_MAX
);
MEGDNN_DEF_DT
(
Uint8
,
dt_uint8
,
INT
,
UNSIGNED
,
0
,
UINT8_MAX
);
MEGDNN_DEF_DT
(
Bool
,
dt_bool
,
BOOL
,
UNSIGNED
,
false
,
true
);
MEGDNN_DEF_DT
(
Uint16
,
dt_uint16
,
INT
,
UNSIGNED
,
0
,
UINT16_MAX
);
MEGDNN_INC_FLOAT16
(
MEGDNN_DEF_DT
(
Float16
,
dt_float16
,
FLOAT
,
SIGNED
,
std
::
numeric_limits
<
dt_float16
>::
lowest
(),
std
::
numeric_limits
<
dt_float16
>::
max
()));
...
...
dnn/test/common/dtype.cpp
浏览文件 @
7066ad5b
...
...
@@ -26,6 +26,7 @@ TEST(TestDType, SizeCheck) {
ASSERT_EQ
(
static_cast
<
size_t
>
(
2
),
::
megdnn
::
dtype
::
IntB4
().
size
(
3
));
ASSERT_EQ
(
static_cast
<
size_t
>
(
2
),
::
megdnn
::
dtype
::
IntB4
().
size
(
4
));
ASSERT_EQ
(
static_cast
<
size_t
>
(
3
),
::
megdnn
::
dtype
::
IntB4
().
size
(
5
));
ASSERT_EQ
(
static_cast
<
size_t
>
(
2
),
::
megdnn
::
dtype
::
Uint16
().
size
(
1
));
ASSERT_EQ
(
static_cast
<
size_t
>
(
2
),
::
megdnn
::
dtype
::
Quantized4Asymm
(
1.0
f
,
static_cast
<
uint8_t
>
(
12
))
.
size
(
3
));
...
...
src/core/include/megbrain/dtype.h
浏览文件 @
7066ad5b
...
...
@@ -28,6 +28,7 @@ using ::megdnn::dt_quint8;
using
::
megdnn
::
dt_qint8
;
using
::
megdnn
::
dt_qint32
;
using
::
megdnn
::
dt_bool
;
using
::
megdnn
::
dt_uint16
;
using
::
megdnn
::
DType
;
using
::
megdnn
::
DTypeEnum
;
using
::
megdnn
::
DTypeTrait
;
...
...
src/opr/impl/loop/forward.cpp
浏览文件 @
7066ad5b
...
...
@@ -370,6 +370,12 @@ cg::OperatorNodeBase::NodeProp* Loop::do_make_node_prop() const {
iv
+=
contain_eq
;
return
std
::
max
(
iv
,
0
);
}
case
DTypeEnum
::
Uint16
:
{
auto
iv
=
val
.
ptr
<
dt_uint16
>
()[
0
];
iv
+=
contain_eq
;
return
std
::
max
<
int
>
(
iv
,
0
);
}
case
DTypeEnum
::
Float32
:
#if !MEGDNN_DISABLE_FLOAT16
case
DTypeEnum
::
Float16
:
...
...
src/opr/impl/loop/impl.cpp
浏览文件 @
7066ad5b
...
...
@@ -249,6 +249,8 @@ MGB_DEFINE_OPR_CLASS(LoopImpl::DescImplBase::LoopCondManager::GetCondOpr,
break
;
case
DTypeEnum
::
Bool
:
break
;
case
DTypeEnum
::
Uint16
:
break
;
#define cb(_dt) \
case DTypeEnum::_dt: \
break;
...
...
src/serialization/impl/dtype.fbs
浏览文件 @
7066ad5b
...
...
@@ -22,6 +22,7 @@ enum DTypeEnum : byte {
QuantizedS16,
BFloat16,
Bool,
Uint16,
}
table LinearQuantizationParam {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录