     const size_t size = filter_size[0]*filter_size[1]*input_size[2]*output_size[2];
 
     double* filter_weights_tmp = (double*) malloc(size*sizeof(double));
-    double* filter_bias_tmp = (double*) malloc(output_size[2]*sizeof(double));
+    double* filter_bias_tmp = (double*) calloc(output_size[2], sizeof(double));
 
     size_t* input_size_tmp = (size_t*) malloc(3*sizeof(size_t));
     size_t* output_size_tmp = (size_t*) malloc(3*sizeof(size_t));

                    }
                }

                sort_sparse_expr(dim, coeff, actual_coeff);

                const double cst = has_bias ? filter_bias[out_z] : 0;

                double* dense_coeff = (double*) malloc(num_pixels*sizeof(double));

                size_t k = 0;
                for(size_t i = 0; i < num_pixels; i++)
                {
                    if((dim[k] == i) && (k < actual_coeff))
                    {
                        dense_coeff[i] = coeff[k];
                        k++;
                    }
                    else
                    {
                        dense_coeff[i] = 0.;
                    }
                }

                expr_t* res = (expr_t*) malloc(sizeof(expr_t));

    size_t* strides_tmp = (size_t*) malloc(2*sizeof(size_t));

    cudaMemcpy(filter_weights_tmp, filter_weights, size*sizeof(double), cudaMemcpyHostToHost);

    if(has_bias)
    {
        cudaMemcpy(filter_bias_tmp, filter_bias, output_size[2]*sizeof(double), cudaMemcpyHostToHost);
    }

    cudaMemcpy(input_size_tmp, input_size, 3*sizeof(size_t), cudaMemcpyHostToHost);
    cudaMemcpy(output_size_tmp, output_size, 3*sizeof(size_t), cudaMemcpyHostToHost);
