Skip to content

Commit

Permalink
Update exception handling and comments in cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
pch0561 committed Feb 10, 2023
1 parent 0d2c518 commit 3268b20
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 deletions.
33 changes: 15 additions & 18 deletions configs/networks/inception-v4.cfg
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# *********************************,,,,,,,,,
# [NETWORK LAYERS],,,,,,,,,
# *********************************,,,,,,,,,
# [GENERAL CONV],,,,,,,,,
# - CONV_# : G=1 & ALL VALUES MUST BE LARGER THAN ZERO,,,,,,,,,
# - FC_# : G=1 & P=Q=S=R=1 & stride=0,,,,,,,,,
# - PW_# : G=1 & S=R=1 & stride=1,,,,,,,,,
# [GROUP CONV],,,,,,,,,
# - GROUP_#: G>1 & 'C' AND 'K' MUST BOTH BE DIVISIBLE BY 'G',,,,,,,,,
# - DEPTH_#: G>1 & G=C & K=CxN (N=POSITIVE INTEGER),,,,,,,,,
# *********************************,,,,,,,,,
# [TEMPLATE],,,,,,,,,
# - CONV_#,1,K,B,P,Q,C,S,R,stride
# - FC_#,1,K,B,1,1,C,1,1,0
# - PW_#,1,K,B,P,Q,C,1,1,1
# - GROUP_#,G,K,B,P,Q,C,S,R,stride
# - DEPTH_#,G,K,B,P,Q,C,S,R,stride
# *********************************,,,,,,,,,
# *********************************
# [NETWORK LAYERS]
# *********************************
# [GENERAL CONV]
# - CONV_# : G=1 & ALL VALUES MUST BE LARGER THAN ZERO
# - FC_# : G=1 & P=Q=S=R=1 & stride=0
# - PW_# : G=1 & S=R=1 & stride=1
# [GROUP CONV]
# - GROUP_#: G>1 & 'C' AND 'K' MUST BOTH BE DIVISIBLE BY 'G'
# - DEPTH_#: G>1 & G=C & K=CxN (N=POSITIVE INTEGER)
# *********************************
# [TEMPLATE]
# - CONV_#=K,B,P,Q,C,S,R,G,stride
# - FC_#=K,B,1,1,C,1,1,1,0
# *********************************
# STEM : CONV1 ~ CONV11
# INCEPTION=A : CONV12 ~ CONV18
# REDUCTION-A : CONV19 ~ CONV22
Expand Down
33 changes: 15 additions & 18 deletions configs/networks/resnet50.cfg
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# *********************************,,,,,,,,,
# [NETWORK LAYERS],,,,,,,,,
# *********************************,,,,,,,,,
# [GENERAL CONV],,,,,,,,,
# - CONV_# : G=1 & ALL VALUES MUST BE LARGER THAN ZERO,,,,,,,,,
# - FC_# : G=1 & P=Q=S=R=1 & stride=0,,,,,,,,,
# - PW_# : G=1 & S=R=1 & stride=1,,,,,,,,,
# [GROUP CONV],,,,,,,,,
# - GROUP_#: G>1 & 'C' AND 'K' MUST BOTH BE DIVISIBLE BY 'G',,,,,,,,,
# - DEPTH_#: G>1 & G=C & K=CxN (N=POSITIVE INTEGER),,,,,,,,,
# *********************************,,,,,,,,,
# [TEMPLATE],,,,,,,,,
# - CONV_#,1,K,B,P,Q,C,S,R,stride
# - FC_#,1,K,B,1,1,C,1,1,0
# - PW_#,1,K,B,P,Q,C,1,1,1
# - GROUP_#,G,K,B,P,Q,C,S,R,stride
# - DEPTH_#,G,K,B,P,Q,C,S,R,stride
# *********************************,,,,,,,,,
# *********************************
# [NETWORK LAYERS]
# *********************************
# [GENERAL CONV]
# - CONV_# : G=1 & ALL VALUES MUST BE LARGER THAN ZERO
# - FC_# : G=1 & P=Q=S=R=1 & stride=0
# - PW_# : G=1 & S=R=1 & stride=1
# [GROUP CONV]
# - GROUP_#: G>1 & 'C' AND 'K' MUST BOTH BE DIVISIBLE BY 'G'
# - DEPTH_#: G>1 & G=C & K=CxN (N=POSITIVE INTEGER)
# *********************************
# [TEMPLATE]
# - CONV_#=K,B,P,Q,C,S,R,G,stride
# - FC_#=K,B,1,1,C,1,1,1,0
# *********************************
[NETWORK]
name=resnet50

Expand Down
13 changes: 13 additions & 0 deletions src/common/layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ layer_t::layer_t(const std::string name_,
:name(name_),
parameters(parameters_),
stride(stride_) {
// Check layer validity
if(parameters.at((unsigned)parameter_t::C)
% parameters.at((unsigned)parameter_t::G) != 0 ||
parameters.at((unsigned)parameter_t::K)
% parameters.at((unsigned)parameter_t::G) != 0) {
std::cerr << "[Error] in Layer `" << name
<< "`, the remainder of input channel (C) (or weight count (K)) / group (G) should be `0`; "
<< "C=" << parameters.at((unsigned)parameter_t::C) << ", "
<< "K=" << parameters.at((unsigned)parameter_t::K) << ", "
<< "G=" << parameters.at((unsigned)parameter_t::G) << " "
<< std::endl;
exit(0);
}
}
layer_t::~layer_t() {}
// Get layer name
Expand Down

0 comments on commit 3268b20

Please sign in to comment.