Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NNVM] Add Bfloat16 typeflag support #4525

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions nnvm/include/nnvm/top/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,14 @@ enum TypeFlag {
kInt32 = 4,
kInt8 = 5,
kInt64 = 6,
kInt16 = 7,
kUint16 = 8,
kUint32 = 9,
kUint64 = 10,
// kBool = 7,
// 7 is reserved for kBool, in order to keep consistency with MXNet TypeFlag defined in
// https://github.com/apache/incubator-mxnet/blob/master/3rdparty/mshadow/mshadow/base.h#L314
kInt16 = 8,
kUint16 = 9,
kUint32 = 10,
kUint64 = 11,
kBfloat16 = 12,
};

enum IndicatorRuleFlag {
Expand All @@ -126,7 +130,8 @@ enum IndicatorRuleFlag {
.add_enum("int8", kInt8) \
.add_enum("int16", kInt16) \
.add_enum("int32", kInt32) \
.add_enum("int64", kInt64)
.add_enum("int64", kInt64) \
.add_enum("bfloat16", kBfloat16)

struct CastParam : public dmlc::Parameter<CastParam> {
int dtype;
Expand Down
1 change: 1 addition & 0 deletions nnvm/src/pass/plan_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static int GetDTypeSize(int type_flag) {
case kInt8:
return 1;
case kFloat16:
case kBfloat16:
case kInt16:
case kUint16:
return 2;
Expand Down