mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
improve compatibility with c++ compilers, prepare for CMake
This commit is contained in:
@ -47,7 +47,7 @@ void cudnn_maxpool_setup(layer *l)
|
||||
|
||||
maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding)
|
||||
{
|
||||
maxpool_layer l = {0};
|
||||
maxpool_layer l = { (LAYER_TYPE)0 };
|
||||
l.type = MAXPOOL;
|
||||
l.batch = batch;
|
||||
l.h = h;
|
||||
@ -62,9 +62,9 @@ maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int s
|
||||
l.size = size;
|
||||
l.stride = stride;
|
||||
int output_size = l.out_h * l.out_w * l.out_c * batch;
|
||||
l.indexes = calloc(output_size, sizeof(int));
|
||||
l.output = calloc(output_size, sizeof(float));
|
||||
l.delta = calloc(output_size, sizeof(float));
|
||||
l.indexes = (int*)calloc(output_size, sizeof(int));
|
||||
l.output = (float*)calloc(output_size, sizeof(float));
|
||||
l.delta = (float*)calloc(output_size, sizeof(float));
|
||||
l.forward = forward_maxpool_layer;
|
||||
l.backward = backward_maxpool_layer;
|
||||
#ifdef GPU
|
||||
@ -93,9 +93,9 @@ void resize_maxpool_layer(maxpool_layer *l, int w, int h)
|
||||
l->outputs = l->out_w * l->out_h * l->c;
|
||||
int output_size = l->outputs * l->batch;
|
||||
|
||||
l->indexes = realloc(l->indexes, output_size * sizeof(int));
|
||||
l->output = realloc(l->output, output_size * sizeof(float));
|
||||
l->delta = realloc(l->delta, output_size * sizeof(float));
|
||||
l->indexes = (int*)realloc(l->indexes, output_size * sizeof(int));
|
||||
l->output = (float*)realloc(l->output, output_size * sizeof(float));
|
||||
l->delta = (float*)realloc(l->delta, output_size * sizeof(float));
|
||||
|
||||
#ifdef GPU
|
||||
CHECK_CUDA(cudaFree((float *)l->indexes_gpu));
|
||||
|
Reference in New Issue
Block a user