Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
a20c710b
Commit
a20c710b
authored
Oct 19, 2018
by
Fenglei
Committed by
Scott Cyphers
Oct 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cast to ArgMin/ArgMax based on reduce_op (#1851)
* add ArgMin, ArgMax * change to scale * format * add exception
parent
fb49e0c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
gpu_emitter.cpp
src/ngraph/runtime/gpu/gpu_emitter.cpp
+19
-5
No files found.
src/ngraph/runtime/gpu/gpu_emitter.cpp
View file @
a20c710b
...
@@ -176,15 +176,29 @@ void runtime::gpu::GPU_Emitter::emit_ArgMin(EMIT_ARGS)
...
@@ -176,15 +176,29 @@ void runtime::gpu::GPU_Emitter::emit_ArgMin(EMIT_ARGS)
external_function
,
writer
,
node
,
args
,
out
,
reduce_op
);
external_function
,
writer
,
node
,
args
,
out
,
reduce_op
);
}
}
void
runtime
::
gpu
::
GPU_Emitter
::
emit_ArgReduce
(
EMIT_ARGS
,
cudnnReduceTensorOp_t
reduce_
mode
)
void
runtime
::
gpu
::
GPU_Emitter
::
emit_ArgReduce
(
EMIT_ARGS
,
cudnnReduceTensorOp_t
reduce_
op
)
{
{
if
(
out
[
0
].
get_size
()
==
0
)
if
(
out
[
0
].
get_size
()
==
0
)
{
{
return
;
return
;
}
}
auto
argmax
=
static_cast
<
const
ngraph
::
op
::
ArgMax
*>
(
node
);
std
::
vector
<
size_t
>
axes
{
argmax
->
get_reduction_axis
()};
size_t
axis
;
auto
axis_set
=
AxisSet
(
axes
);
if
(
reduce_op
==
CUDNN_REDUCE_TENSOR_MIN
)
{
auto
argmin
=
static_cast
<
const
ngraph
::
op
::
ArgMin
*>
(
node
);
axis
=
argmin
->
get_reduction_axis
();
}
else
if
(
reduce_op
==
CUDNN_REDUCE_TENSOR_MAX
)
{
auto
argmax
=
static_cast
<
const
ngraph
::
op
::
ArgMax
*>
(
node
);
axis
=
argmax
->
get_reduction_axis
();
}
else
{
throw
std
::
runtime_error
(
"Not supported. Only Min/Max op are supported by ArgReduce."
);
}
auto
axis_set
=
AxisSet
{
axis
};
std
::
vector
<
element
::
Type
>
dtypes
{
args
[
0
].
get_element_type
(),
out
[
0
].
get_element_type
()};
std
::
vector
<
element
::
Type
>
dtypes
{
args
[
0
].
get_element_type
(),
out
[
0
].
get_element_type
()};
...
@@ -192,7 +206,7 @@ void runtime::gpu::GPU_Emitter::emit_ArgReduce(EMIT_ARGS, cudnnReduceTensorOp_t
...
@@ -192,7 +206,7 @@ void runtime::gpu::GPU_Emitter::emit_ArgReduce(EMIT_ARGS, cudnnReduceTensorOp_t
{
{
auto
&
cudnn_emitter
=
external_function
->
get_primitive_emitter
()
->
get_cudnn_emitter
();
auto
&
cudnn_emitter
=
external_function
->
get_primitive_emitter
()
->
get_cudnn_emitter
();
auto
index
=
cudnn_emitter
->
build_reduce_forward
(
reduce_
mode
,
auto
index
=
cudnn_emitter
->
build_reduce_forward
(
reduce_
op
,
dtypes
,
dtypes
,
args
[
0
].
get_shape
(),
args
[
0
].
get_shape
(),
axis_set
,
axis_set
,
...
...
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