-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcol2im.cpp
More file actions
43 lines (39 loc) · 1.15 KB
/
col2im.cpp
File metadata and controls
43 lines (39 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//========================================================================
// Col2im header file
//========================================================================
// @brief: post-processing image data
// column to image: filters%batch == 0
void col2img(float *c_col,float *c, int m, int n, int count, int batch)
{
for(int k = 0; k < count; k++)
{
for(int i = 0; i < batch; i++)
{
for(int j = 0; j < n; j++)
{
c[j+k*n*batch+i*n] = c_col[k*n*batch+i+j*batch];
}
}
}
}
// column to image: filters%batch == 0
void col2img_extra(float *c_col,float *c, int m, int n, int count, int batch)
{
for(int k = 0; k < count-1; k++)
{
for(int i = 0; i < batch; i++)
{
for(int j = 0; j < n; j++)
{
c[i*n+j+k*n*batch] = c_col[i+j*batch+k*n*batch];
}
}
}
for(int i = 0; i < m%batch; i++)
{
for(int j = 0; j < n; j++)
{
c[i*n+j+(m/batch)*n*batch] = c_col[i+j*batch+(m/batch)*n*batch];
}
}
}