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
c3922f05
Commit
c3922f05
authored
Feb 25, 2019
by
Shucai Xiao
Browse files
Merge branch 'gather_operator' into seq2seq_example
parents
8a079721
1871d141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/include/migraphx/operators.hpp
src/include/migraphx/operators.hpp
+5
-5
No files found.
src/include/migraphx/operators.hpp
View file @
c3922f05
...
@@ -774,8 +774,8 @@ struct gather
...
@@ -774,8 +774,8 @@ struct gather
return
{
type
,
lens
};
return
{
type
,
lens
};
}
}
template
<
typename
V
>
template
<
typename
T
>
std
::
vector
<
std
::
size_t
>
compute_data_index
(
const
V
&
indices
,
std
::
vector
<
std
::
size_t
>
compute_data_index
(
const
tensor_view
<
T
>
&
indices
,
const
int
axis_index
,
const
int
axis_index
,
const
std
::
vector
<
std
::
size_t
>&
out_idx
)
const
const
std
::
vector
<
std
::
size_t
>&
out_idx
)
const
{
{
...
@@ -785,13 +785,13 @@ struct gather
...
@@ -785,13 +785,13 @@ struct gather
{
{
auto
start_it
=
data_idx
.
begin
()
+
axis_index
;
auto
start_it
=
data_idx
.
begin
()
+
axis_index
;
auto
end_it
=
data_idx
.
begin
()
+
axis_index
+
indices
.
get_shape
().
lens
().
size
();
auto
end_it
=
data_idx
.
begin
()
+
axis_index
+
indices
.
get_shape
().
lens
().
size
();
std
::
vector
<
std
::
size_t
>
ind_idx
(
start_it
,
end_it
);
std
::
vector
<
T
>
ind_idx
(
start_it
,
end_it
);
data_idx
.
erase
(
start_it
,
end_it
);
data_idx
.
erase
(
start_it
,
end_it
);
index
=
indices
(
ind_idx
.
begin
(),
ind_idx
.
end
());
index
=
static_cast
<
std
::
size_t
>
(
indices
(
ind_idx
.
begin
(),
ind_idx
.
end
())
)
;
}
}
else
else
{
{
index
=
indices
.
front
();
index
=
static_cast
<
std
::
size_t
>
(
indices
.
front
()
)
;
}
}
data_idx
.
insert
(
data_idx
.
begin
()
+
axis_index
,
index
);
data_idx
.
insert
(
data_idx
.
begin
()
+
axis_index
,
index
);
...
...
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