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
09c946b2
Commit
09c946b2
authored
Jun 25, 2018
by
Scott Thornton
Browse files
Added MNIST driver
parent
003e2eb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
src/include/rtg/tensor_view.hpp
src/include/rtg/tensor_view.hpp
+2
-0
src/onnx/mnist.cpp
src/onnx/mnist.cpp
+2
-1
No files found.
src/include/rtg/tensor_view.hpp
View file @
09c946b2
...
@@ -29,12 +29,14 @@ struct tensor_view
...
@@ -29,12 +29,14 @@ struct tensor_view
template
<
class
...
Ts
,
RTG_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
template
<
class
...
Ts
,
RTG_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
const
T
&
operator
()(
Ts
...
xs
)
const
const
T
&
operator
()(
Ts
...
xs
)
const
{
{
assert
(
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})
<
m_shape
.
bytes
()
/
sizeof
(
T
));
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
}
}
template
<
class
...
Ts
,
RTG_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
template
<
class
...
Ts
,
RTG_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
T
&
operator
()(
Ts
...
xs
)
T
&
operator
()(
Ts
...
xs
)
{
{
assert
(
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})
<
m_shape
.
bytes
()
/
sizeof
(
T
));
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
}
}
...
...
src/onnx/mnist.cpp
View file @
09c946b2
...
@@ -136,7 +136,8 @@ int main(int argc, char const* argv[])
...
@@ -136,7 +136,8 @@ int main(int argc, char const* argv[])
std
::
string
file
=
argv
[
1
];
std
::
string
file
=
argv
[
1
];
auto
prog
=
rtg
::
parse_onnx
(
file
);
auto
prog
=
rtg
::
parse_onnx
(
file
);
prog
.
compile
(
rtg
::
cpu
::
cpu_target
{});
prog
.
compile
(
rtg
::
cpu
::
cpu_target
{});
auto
s
=
prog
.
get_parameter_shape
(
"Input3"
);
// auto s = prog.get_parameter_shape("Input3");
auto
s
=
rtg
::
shape
{
rtg
::
shape
::
float_type
,
{
1
,
1
,
28
,
28
}};
std
::
cout
<<
s
<<
std
::
endl
;
std
::
cout
<<
s
<<
std
::
endl
;
auto
input3
=
rtg
::
argument
{
s
,
input
.
data
()};
auto
input3
=
rtg
::
argument
{
s
,
input
.
data
()};
auto
out
=
prog
.
eval
({{
"Input3"
,
input3
}});
auto
out
=
prog
.
eval
({{
"Input3"
,
input3
}});
...
...
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