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
83b91229
Commit
83b91229
authored
Jun 29, 2018
by
Paul
Browse files
Formatting
parent
8e0fff81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
src/include/rtg/operators.hpp
src/include/rtg/operators.hpp
+14
-13
src/onnx/verify_onnx.cpp
src/onnx/verify_onnx.cpp
+1
-2
src/targets/miopen/miopen_target.cpp
src/targets/miopen/miopen_target.cpp
+4
-4
No files found.
src/include/rtg/operators.hpp
View file @
83b91229
...
...
@@ -15,22 +15,26 @@ struct check_shapes
const
std
::
string
name
;
check_shapes
(
const
std
::
vector
<
shape
>&
s
)
:
shapes
(
&
s
)
{}
template
<
class
Op
>
check_shapes
(
const
std
::
vector
<
shape
>&
s
,
const
Op
&
op
)
:
shapes
(
&
s
),
name
(
op
.
name
())
{}
template
<
class
Op
>
check_shapes
(
const
std
::
vector
<
shape
>&
s
,
const
Op
&
op
)
:
shapes
(
&
s
),
name
(
op
.
name
())
{
}
std
::
string
prefix
()
const
{
if
(
name
.
empty
())
return
""
;
else
return
name
+
": "
;
if
(
name
.
empty
())
return
""
;
else
return
name
+
": "
;
}
const
check_shapes
&
has
(
std
::
size_t
n
)
const
{
assert
(
shapes
!=
nullptr
);
if
(
shapes
->
size
()
!=
n
)
RTG_THROW
(
prefix
()
+
"Wrong number of arguments: expected "
+
std
::
to_string
(
n
)
+
" but given "
+
std
::
to_string
(
shapes
->
size
()));
RTG_THROW
(
prefix
()
+
"Wrong number of arguments: expected "
+
std
::
to_string
(
n
)
+
" but given "
+
std
::
to_string
(
shapes
->
size
()));
return
*
this
;
}
...
...
@@ -508,15 +512,12 @@ struct outline
argument
compute
(
context
&
,
shape
,
std
::
vector
<
argument
>
)
const
{
return
{
s
,
nullptr
};
}
};
template
<
class
T
>
template
<
class
T
>
struct
check_context
{
std
::
string
name
()
const
{
return
"check_context"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
)
const
{
return
{};
}
argument
compute
(
context
&
ctx
,
shape
,
std
::
vector
<
argument
>
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
)
const
{
return
{};
}
argument
compute
(
context
&
ctx
,
shape
,
std
::
vector
<
argument
>
)
const
{
T
*
x
=
any_cast
<
T
>
(
&
ctx
);
if
(
x
==
nullptr
)
...
...
src/onnx/verify_onnx.cpp
View file @
83b91229
...
...
@@ -29,8 +29,7 @@ rtg::argument run_gpu(std::string file)
auto
output
=
rtg
::
miopen
::
to_gpu
(
rtg
::
generate_argument
(
p
.
get_parameter_shape
(
"output"
)));
auto
handle
=
rtg
::
miopen
::
make_obj
<
rtg
::
miopen
::
miopen_handle
>
(
&
miopenCreate
);
auto
out
=
p
.
eval
(
{{
"Input3"
,
input3
},
{
"output"
,
output
}});
auto
out
=
p
.
eval
({{
"Input3"
,
input3
},
{
"output"
,
output
}});
std
::
cout
<<
p
<<
std
::
endl
;
return
rtg
::
miopen
::
from_gpu
(
out
);
}
...
...
src/targets/miopen/miopen_target.cpp
View file @
83b91229
...
...
@@ -28,7 +28,7 @@ struct miopen_convolution
}
argument
compute
(
context
&
gctx
,
shape
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
x_desc
=
make_tensor
(
args
[
0
].
get_shape
());
auto
w_desc
=
make_tensor
(
args
[
1
].
get_shape
());
auto
y_desc
=
make_tensor
(
output_shape
);
...
...
@@ -80,7 +80,7 @@ struct miopen_pooling
}
argument
compute
(
context
&
gctx
,
shape
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
x_desc
=
make_tensor
(
args
[
0
].
get_shape
());
auto
y_desc
=
make_tensor
(
output_shape
);
...
...
@@ -128,7 +128,7 @@ struct miopen_add
}
else
{
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
float
alpha
=
1
,
beta
=
0
;
auto
a_desc
=
make_tensor
(
args
[
0
].
get_shape
());
auto
b_desc
=
make_tensor
(
args
[
1
].
get_shape
());
...
...
@@ -185,7 +185,7 @@ struct miopen_relu
argument
compute
(
context
&
gctx
,
shape
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
auto
&
ctx
=
any_cast
<
miopen_context
>
(
gctx
);
float
alpha
=
1
,
beta
=
0
;
auto
x_desc
=
make_tensor
(
args
[
0
].
get_shape
());
auto
y_desc
=
make_tensor
(
output_shape
);
...
...
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