Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
0aa847f9
Commit
0aa847f9
authored
Sep 12, 2018
by
Scott Thornton
Browse files
refactored loops in im2col
parent
c1241216
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
src/targets/cpu/cpu_lowering.cpp
src/targets/cpu/cpu_lowering.cpp
+12
-18
No files found.
src/targets/cpu/cpu_lowering.cpp
View file @
0aa847f9
...
...
@@ -177,26 +177,20 @@ struct cpu_im2col
// compute linear index for output
std
::
size_t
ldx
=
ioutput
*
col_width
+
joutput
;
std
::
size_t
p
=
0
;
for
(
std
::
size_t
c
=
0
;
c
<
channels
;
c
++
)
{
for
(
int
koffset
=
-
kdiv2_h
;
koffset
<=
kdiv2_h
;
koffset
++
)
{
for
(
int
loffset
=
-
kdiv2_w
;
loffset
<=
kdiv2_w
;
loffset
++
)
d
for
(
channels
,
kernel_h
,
kernel_w
)(
[
&
](
std
::
size_t
c
,
std
::
size_t
koffset
,
std
::
size_t
loffset
)
{
int
idx
=
iinput
+
koffset
-
kdiv2_h
;
int
jdx
=
jinput
+
loffset
-
kdiv2_w
;
if
((
idx
>=
0
)
&&
(
idx
<
height
)
&&
(
jdx
>=
0
)
&&
(
jdx
<
width
)
)
{
int
idx
=
iinput
+
koffset
;
int
jdx
=
jinput
+
loffset
;
if
((
idx
>=
0
)
&&
(
idx
<
height
)
&&
(
jdx
>=
0
)
&&
(
jdx
<
width
))
{
col
[
ldx
*
ksize
+
p
]
=
input
[
c
*
npixels
+
idx
*
width
+
jdx
];
}
else
{
col
[
ldx
*
ksize
+
p
]
=
0
;
}
p
++
;
col
[
ldx
*
ksize
+
p
]
=
input
[
c
*
npixels
+
idx
*
width
+
jdx
];
}
}
}
else
{
col
[
ldx
*
ksize
+
p
]
=
0
;
}
p
++
;
});
}
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment