Skip to content

Commit

Permalink
Add the missing auto-generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed Nov 2, 2019
1 parent f498eac commit e637232
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
33 changes: 30 additions & 3 deletions common/daq.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,36 @@ enum DataType:byte { Float32, Int8, Int32, Float16, Bool8,
QUANT8_ASYMM, QUANT8_SYMM, QUANT8_SYMM_PER_CHANNEL,
QUANT16_ASYMM, QUANT16_SYMM}
enum FuseCode:byte { None, Relu, Relu1, Relu6 }
enum LayerType:byte { Conv2D = 0, AvePool, MaxPool, Relu, Softmax, FC, Add, Concat,
DepthwiseConv2D, BatchToSpace, SpaceToBatch, StridedSlice, Mul, AddScalar, MulScalar,
Dequantize, LRN, Tanh, Floor, Logistic}
enum LayerType:byte {
// Auto generated layer types start
Conv2D,
AvePool,
MaxPool,
Relu,
Softmax,
FC,
Add,
Concat,
DepthwiseConv2D,
BatchToSpace,
SpaceToBatch,
StridedSlice,
Mul,
AddScalar,
MulScalar,
Dequantize,
LRN,
Tanh,
Floor,
Logistic,
PReLU,
Pow,
Neg,
Minimum,
Maximum,
Log,
// Auto generated layer types end
}

table Tensor {
data_type:DataType;
Expand Down
3 changes: 3 additions & 0 deletions generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ def generate_fbs():
for i, op in enumerate(cfg):
cogoutl(f" {op['dnn']}_param:{op['dnn']};")
update_code('common/daq.fbs', 'Auto generated fields', reformat=False)
for i, op in enumerate(cfg):
cogoutl(f" {op['dnn']},")
update_code('common/daq.fbs', 'Auto generated layer types', reformat=False)


def generate_model_builder():
Expand Down
26 changes: 22 additions & 4 deletions include/common/daq_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,17 @@ enum class LayerType : int8_t {
Tanh = 17,
Floor = 18,
Logistic = 19,
PReLU = 20,
Pow = 21,
Neg = 22,
Minimum = 23,
Maximum = 24,
Log = 25,
MIN = Conv2D,
MAX = Logistic
MAX = Log
};

inline const LayerType (&EnumValuesLayerType())[20] {
inline const LayerType (&EnumValuesLayerType())[26] {
static const LayerType values[] = {
LayerType::Conv2D,
LayerType::AvePool,
Expand All @@ -207,7 +213,13 @@ inline const LayerType (&EnumValuesLayerType())[20] {
LayerType::LRN,
LayerType::Tanh,
LayerType::Floor,
LayerType::Logistic
LayerType::Logistic,
LayerType::PReLU,
LayerType::Pow,
LayerType::Neg,
LayerType::Minimum,
LayerType::Maximum,
LayerType::Log
};
return values;
}
Expand All @@ -234,13 +246,19 @@ inline const char * const *EnumNamesLayerType() {
"Tanh",
"Floor",
"Logistic",
"PReLU",
"Pow",
"Neg",
"Minimum",
"Maximum",
"Log",
nullptr
};
return names;
}

inline const char *EnumNameLayerType(LayerType e) {
if (e < LayerType::Conv2D || e > LayerType::Logistic) return "";
if (e < LayerType::Conv2D || e > LayerType::Log) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesLayerType()[index];
}
Expand Down

0 comments on commit e637232

Please sign in to comment.