From f64746107d057a958d96cc0b118ad3eae78a2a91 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Wed, 25 Dec 2019 00:17:01 +0300 Subject: [PATCH] Fixed add_bias vs batch_norm on CPU --- src/convolutional_layer.c | 4 +++- src/parser.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/convolutional_layer.c b/src/convolutional_layer.c index 93e4ff37..49dfab14 100644 --- a/src/convolutional_layer.c +++ b/src/convolutional_layer.c @@ -1249,7 +1249,9 @@ void forward_convolutional_layer(convolutional_layer l, network_state state) if(l.batch_normalize){ forward_batchnorm_layer(l, state); } - add_bias(l.output, l.biases, l.batch, l.n, out_h*out_w); + else { + add_bias(l.output, l.biases, l.batch, l.n, out_h*out_w); + } //activate_array(l.output, m*n*l.batch, l.activation); if (l.activation == SWISH) activate_array_swish(l.output, l.outputs*l.batch, l.activation_input, l.output); diff --git a/src/parser.c b/src/parser.c index 94d23a30..ec9e3007 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1864,10 +1864,11 @@ network *load_network_custom(char *cfg, char *weights, int clear, int batch) { printf(" Try to load cfg: %s, weights: %s, clear = %d \n", cfg, weights, clear); network* net = (network*)calloc(1, sizeof(network)); - *net = parse_network_cfg_custom(cfg, batch, 0); + *net = parse_network_cfg_custom(cfg, batch, 1); if (weights && weights[0] != 0) { load_weights(net, weights); } + //fuse_conv_batchnorm(*net); if (clear) (*net->seen) = 0; return net; }