Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
837bce78
Commit
837bce78
authored
May 21, 2018
by
Paul
Browse files
Formatting
parent
f199ea9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
23 deletions
+21
-23
src/include/rtg/raw_data.hpp
src/include/rtg/raw_data.hpp
+5
-5
src/targets/cpu/cpu_target.cpp
src/targets/cpu/cpu_target.cpp
+16
-18
No files found.
src/include/rtg/raw_data.hpp
View file @
837bce78
...
@@ -96,16 +96,16 @@ struct raw_data
...
@@ -96,16 +96,16 @@ struct raw_data
}
}
};
};
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
auto
visit_all
(
T
&&
x
,
Ts
&&
...
xs
)
auto
visit_all
(
T
&&
x
,
Ts
&&
...
xs
)
{
{
auto
&&
s
=
x
.
get_shape
();
auto
&&
s
=
x
.
get_shape
();
std
::
initializer_list
<
shape
::
type_t
>
types
=
{
xs
.
get_shape
().
type
()...};
std
::
initializer_list
<
shape
::
type_t
>
types
=
{
xs
.
get_shape
().
type
()...};
if
(
!
std
::
all_of
(
types
.
begin
(),
types
.
end
(),
[
&
](
shape
::
type_t
t
)
{
return
t
==
s
.
type
();
}))
if
(
!
std
::
all_of
(
types
.
begin
(),
types
.
end
(),
[
&
](
shape
::
type_t
t
)
{
return
t
==
s
.
type
();
}))
RTG_THROW
(
"Types must be the same"
);
RTG_THROW
(
"Types must be the same"
);
return
[
&
](
auto
v
)
{
return
[
&
](
auto
v
)
{
s
.
visit_type
([
&
](
auto
as
)
{
s
.
visit_type
([
&
](
auto
as
)
{
v
(
make_view
(
s
,
as
.
from
(
x
.
data
())),
make_view
(
xs
.
get_shape
(),
as
.
from
(
xs
.
data
()))...);
v
(
make_view
(
s
,
as
.
from
(
x
.
data
())),
make_view
(
xs
.
get_shape
(),
as
.
from
(
xs
.
data
()))...);
});
});
};
};
}
}
...
...
src/targets/cpu/cpu_target.cpp
View file @
837bce78
...
@@ -27,25 +27,23 @@ struct cpu_convolution
...
@@ -27,25 +27,23 @@ struct cpu_convolution
auto
wei_h
=
weights
.
get_shape
().
lens
()[
2
];
auto
wei_h
=
weights
.
get_shape
().
lens
()[
2
];
auto
wei_w
=
weights
.
get_shape
().
lens
()[
3
];
auto
wei_w
=
weights
.
get_shape
().
lens
()[
3
];
dfor
(
in_n
,
dfor
(
in_n
,
in_c
,
in_h
,
in_w
)(
in_c
,
[
&
](
std
::
size_t
o
,
std
::
size_t
w
,
std
::
size_t
i
,
std
::
size_t
j
)
{
in_h
,
const
int
start_x
=
i
*
op
.
stride
[
0
]
-
op
.
padding
[
0
];
in_w
)([
&
](
std
::
size_t
o
,
std
::
size_t
w
,
std
::
size_t
i
,
std
::
size_t
j
)
{
const
int
start_y
=
j
*
op
.
stride
[
1
]
-
op
.
padding
[
1
];
const
int
start_x
=
i
*
op
.
stride
[
0
]
-
op
.
padding
[
0
];
const
int
start_y
=
j
*
op
.
stride
[
1
]
-
op
.
padding
[
1
]
;
double
acc
=
0
;
dfor
(
wei_c
,
wei_h
,
wei_w
)([
&
](
std
::
size_t
k
,
std
::
size_t
x
,
std
::
size_t
y
)
{
double
acc
=
0
;
const
int
in_x
=
start_x
+
x
;
dfor
(
wei_c
,
wei_h
,
wei_w
)([
&
](
std
::
size_t
k
,
std
::
size_t
x
,
std
::
size_t
y
)
{
const
int
in_y
=
start_y
+
y
;
const
int
in_x
=
start_x
+
x
;
if
(
in_x
>=
0
&&
in_x
<
in_h
&&
in_y
>=
0
&&
in_y
<
in_w
)
const
int
in_y
=
start_y
+
y
;
{
if
(
in_x
>=
0
&&
in_x
<
in_h
&&
in_y
>=
0
&&
in_y
<
in_w
)
acc
+=
input
(
o
,
k
,
in_x
,
in_y
)
*
weights
(
w
,
k
,
x
,
y
);
{
}
acc
+=
input
(
o
,
k
,
in_x
,
in_y
)
*
weights
(
w
,
k
,
x
,
y
);
}
);
}
output
(
o
,
w
,
i
,
j
)
=
acc
;
});
});
output
(
o
,
w
,
i
,
j
)
=
acc
;
});
});
});
return
result
;
return
result
;
}
}
...
...
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