Skip to content

Commit

Permalink
Merge pull request #62 from JDAI-CV/update
Browse files Browse the repository at this point in the history
Support tanh and floor, move implementation to separate files
  • Loading branch information
daquexian authored Aug 6, 2019
2 parents b7073db + 589611c commit 7e70872
Show file tree
Hide file tree
Showing 13 changed files with 1,683 additions and 1,396 deletions.
14 changes: 13 additions & 1 deletion common/daq.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enum DataType:byte { Float32 = 0, Int8, Int32, Float16, Bool8,
enum FuseCode:byte { None = 0, Relu, Relu1, Relu6 }
enum LayerType:byte { Conv2D = 0, AvePool, MaxPool, Relu, Softmax, FC, Add, Concat,
DepthwiseConv2D, BatchToSpace, SpaceToBatch, StridedSlice, Mul, AddScalar, MulScalar,
Dequantize, LRN}
Dequantize, LRN, Tanh, Floor}

table Tensor {
data_type:DataType;
Expand Down Expand Up @@ -164,6 +164,16 @@ table LRN {
output:string;
}

table Tanh {
input:string;
output:string;
}

table Floor {
input:string;
output:string;
}

table Layer {
type:LayerType;
conv2d_param:Conv2D;
Expand All @@ -183,6 +193,8 @@ table Layer {
mul_scalar_param:MulScalar;
dequantize_param:Dequantize;
lrn_param:LRN;
tanh_param:Tanh;
floor_param:Floor;
}

table Model {
Expand Down
1 change: 1 addition & 0 deletions dnnlibrary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(dnnlibrary_src
operand_helper.h
flatbuffers_helper.h
ModelBuilder.cpp
ModelBuilderImpl.cpp
Model.cpp
DaqReader.cpp
NeuralNetworksWrapper.cpp
Expand Down
14 changes: 13 additions & 1 deletion dnnlibrary/DaqReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ std::string layer_type_to_str(DNN::LayerType type) {
return "dequantize";
case DNN::LayerType::LRN:
return "LRN";
case DNN::LayerType::Tanh:
return "tanh";
case DNN::LayerType::Floor:
return "floor";
}
}

Expand Down Expand Up @@ -259,7 +263,7 @@ void AddLayers(const DNN::Model &model, ModelBuilder &builder) {
}
case DNN::LayerType::Softmax: {
UNPACK_LAYER(softmax, input, output);
builder.AddSoftMax(input, 1.f, output);
builder.AddSoftmax(input, 1.f, output);
break;
}
case DNN::LayerType::Concat: {
Expand Down Expand Up @@ -300,6 +304,14 @@ void AddLayers(const DNN::Model &model, ModelBuilder &builder) {
ADD_LAYER(lrn, LRN, input, radius, bias, alpha, beta, output);
break;
}
case DNN::LayerType::Tanh: {
ADD_LAYER(tanh, Tanh, input, output);
break;
}
case DNN::LayerType::Floor: {
ADD_LAYER(floor, Floor, input, output);
break;
}
}
}
}
Expand Down
Loading

0 comments on commit 7e70872

Please sign in to comment.