@@ -473,10 +473,10 @@ convolutional_layer make_convolutional_layer(int batch, int steps, int h, int w,
473
473
l .scale_v = (float * )calloc (n , sizeof (float ));
474
474
}
475
475
476
- if (l .activation == SWISH ) l .output_sigmoid = (float * )calloc (total_batch * l .outputs , sizeof (float ));
476
+ if (l .activation == SWISH || l . activation == MISH ) l .activation_input = (float * )calloc (total_batch * l .outputs , sizeof (float ));
477
477
478
478
#ifdef GPU
479
- if (l .activation == SWISH ) l .output_sigmoid_gpu = cuda_make_array (l .output_sigmoid , total_batch * out_h * out_w * n );
479
+ if (l .activation == SWISH || l . activation == MISH ) l .activation_input_gpu = cuda_make_array (l .activation_input , total_batch * out_h * out_w * n );
480
480
481
481
l .forward_gpu = forward_convolutional_layer_gpu ;
482
482
l .backward_gpu = backward_convolutional_layer_gpu ;
@@ -1100,7 +1100,8 @@ void forward_convolutional_layer(convolutional_layer l, network_state state)
1100
1100
add_bias (l .output , l .biases , l .batch , l .n , out_h * out_w );
1101
1101
1102
1102
//activate_array(l.output, m*n*l.batch, l.activation);
1103
- if (l .activation == SWISH ) activate_array_swish (l .output , l .outputs * l .batch , l .output_sigmoid , l .output );
1103
+ if (l .activation == SWISH ) activate_array_swish (l .output , l .outputs * l .batch , l .activation_input , l .output );
1104
+ else if (l .activation == MISH ) activate_array_mish (l .output , l .outputs * l .batch , l .activation_input , l .output );
1104
1105
else activate_array_cpu_custom (l .output , m * n * l .batch , l .activation );
1105
1106
return ;
1106
1107
@@ -1139,7 +1140,8 @@ void forward_convolutional_layer(convolutional_layer l, network_state state)
1139
1140
add_bias (l .output , l .biases , l .batch , l .n , out_h * out_w );
1140
1141
1141
1142
//activate_array(l.output, m*n*l.batch, l.activation);
1142
- if (l .activation == SWISH ) activate_array_swish (l .output , l .outputs * l .batch , l .output_sigmoid , l .output );
1143
+ if (l .activation == SWISH ) activate_array_swish (l .output , l .outputs * l .batch , l .activation_input , l .output );
1144
+ else if (l .activation == MISH ) activate_array_mish (l .output , l .outputs * l .batch , l .activation_input , l .output );
1143
1145
else activate_array_cpu_custom (l .output , l .outputs * l .batch , l .activation );
1144
1146
1145
1147
if (l .binary || l .xnor ) swap_binary (& l );
@@ -1276,7 +1278,8 @@ void backward_convolutional_layer(convolutional_layer l, network_state state)
1276
1278
int n = l .size * l .size * l .c / l .groups ;
1277
1279
int k = l .out_w * l .out_h ;
1278
1280
1279
- if (l .activation == SWISH ) gradient_array_swish (l .output , l .outputs * l .batch , l .output_sigmoid , l .delta );
1281
+ if (l .activation == SWISH ) gradient_array_swish (l .output , l .outputs * l .batch , l .activation_input , l .delta );
1282
+ else if (l .activation == MISH ) gradient_array_mish (l .outputs * l .batch , l .activation_input , l .delta );
1280
1283
else gradient_array (l .output , l .outputs * l .batch , l .activation , l .delta );
1281
1284
1282
1285
if (l .batch_normalize ) {
0 commit comments