Joseph Redmon
2016-11-16 c71bff69eaf1e458850ab78a32db8aa25fee17dc
src/convolutional_layer.c
@@ -235,6 +235,11 @@
        l.rolling_mean = calloc(n, sizeof(float));
        l.rolling_variance = calloc(n, sizeof(float));
    }
    if(adam){
        l.adam = 1;
        l.m = calloc(c*n*size*size, sizeof(float));
        l.v = calloc(c*n*size*size, sizeof(float));
    }
#ifdef GPU
    l.forward_gpu = forward_convolutional_layer_gpu;
@@ -243,9 +248,8 @@
    if(gpu_index >= 0){
        if (adam) {
            l.adam = 1;
            l.m_gpu = cuda_make_array(l.weight_updates, c*n*size*size);
            l.v_gpu = cuda_make_array(l.weight_updates, c*n*size*size);
            l.m_gpu = cuda_make_array(l.m, c*n*size*size);
            l.v_gpu = cuda_make_array(l.v, c*n*size*size);
        }
        l.weights_gpu = cuda_make_array(l.weights, c*n*size*size);
@@ -296,7 +300,7 @@
    l.workspace_size = get_workspace_size(l);
    l.activation = activation;
    fprintf(stderr, "Convolutional Layer: %d x %d x %d image, %d filters -> %d x %d x %d image\n", h,w,c,n, out_h, out_w, n);
    fprintf(stderr, "conv  %5d %2d x%2d /%2d  %4d x%4d x%4d   ->  %4d x%4d x%4d\n", n, size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c);
    return l;
}
@@ -364,6 +368,14 @@
    l->delta_gpu =     cuda_make_array(l->delta, l->batch*out_h*out_w*l->n);
    l->output_gpu =    cuda_make_array(l->output, l->batch*out_h*out_w*l->n);
    if(l->batch_normalize){
        cuda_free(l->x_gpu);
        cuda_free(l->x_norm_gpu);
        l->x_gpu = cuda_make_array(l->output, l->batch*l->outputs);
        l->x_norm_gpu = cuda_make_array(l->output, l->batch*l->outputs);
    }
#ifdef CUDNN
    cudnn_convolutional_setup(l);
#endif