Skip to content

Commit

Permalink
[Conv]change valloc function to malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjunjiang committed Dec 12, 2020
1 parent f8fd8e7 commit a5e3221
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/default/Conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ static void Conv_float16(struct onnx_node_t * n)
typedef float (*mytype)/*[oH * oW]*/[MM];

/* try im2col first */
matw = valloc(MM * H * W * C * sizeof(float));
matx = valloc(oH * oW * H * W * C * sizeof(float));
maty = valloc(oH * oW * MM * sizeof(float));
matw = malloc(MM * H * W * C * sizeof(float));
matx = malloc(oH * oW * H * W * C * sizeof(float));
maty = malloc(oH * oW * MM * sizeof(float));
if (matw && matx && maty)
{
conv_mode = CONV_IM2COL;
Expand All @@ -334,7 +334,7 @@ static void Conv_float16(struct onnx_node_t * n)
if (maty) free(maty);

/* then try cached conv */
pxcache = valloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(float));
pxcache = malloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(float));
if (pxcache)
{
conv_mode = CONV_CACHED;
Expand Down Expand Up @@ -606,9 +606,9 @@ static void Conv_float32(struct onnx_node_t * n)
typedef float (*mytype)/*[oH * oW]*/[MM];

/* try im2col first */
matw = valloc(MM * H * W * C * sizeof(float));
matx = valloc(oH * oW * H * W * C * sizeof(float));
maty = valloc(oH * oW * MM * sizeof(float));
matw = malloc(MM * H * W * C * sizeof(float));
matx = malloc(oH * oW * H * W * C * sizeof(float));
maty = malloc(oH * oW * MM * sizeof(float));
if (matw && matx && maty)
{
conv_mode = CONV_IM2COL;
Expand All @@ -620,7 +620,7 @@ static void Conv_float32(struct onnx_node_t * n)
if (maty) free(maty);

/* then try cached conv */
pxcache = valloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(float));
pxcache = malloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(float));
if (pxcache)
{
conv_mode = CONV_CACHED;
Expand Down Expand Up @@ -892,9 +892,9 @@ static void Conv_float64(struct onnx_node_t * n)
typedef double (*mytype)/*[oH * oW]*/[MM];

/* try im2col first */
matw = valloc(MM * H * W * C * sizeof(double));
matx = valloc(oH * oW * H * W * C * sizeof(double));
maty = valloc(oH * oW * MM * sizeof(double));
matw = malloc(MM * H * W * C * sizeof(double));
matx = malloc(oH * oW * H * W * C * sizeof(double));
maty = malloc(oH * oW * MM * sizeof(double));
if (matw && matx && maty)
{
conv_mode = CONV_IM2COL;
Expand All @@ -906,7 +906,7 @@ static void Conv_float64(struct onnx_node_t * n)
if (maty) free(maty);

/* then try cached conv */
pxcache = valloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(double));
pxcache = malloc(oN * (oC * pdat->group / M) * C * H * W * sizeof(double));
if (pxcache)
{
conv_mode = CONV_CACHED;
Expand Down

0 comments on commit a5e3221

Please sign in to comment.