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
26277ec5
Commit
26277ec5
authored
Aug 29, 2022
by
Paul
Browse files
Fix accuracy bug when vectorizing slices
parent
ed7973d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/targets/gpu/compile_gen.cpp
src/targets/gpu/compile_gen.cpp
+7
-2
No files found.
src/targets/gpu/compile_gen.cpp
View file @
26277ec5
...
@@ -61,12 +61,17 @@ vectorize vectorize::elements(std::size_t axis, const std::vector<shape>& inputs
...
@@ -61,12 +61,17 @@ vectorize vectorize::elements(std::size_t axis, const std::vector<shape>& inputs
[
&
](
const
auto
&
input
)
->
std
::
size_t
{
[
&
](
const
auto
&
input
)
->
std
::
size_t
{
auto
stride
=
input
.
strides
()[
axis
];
auto
stride
=
input
.
strides
()[
axis
];
auto
len
=
input
.
lens
()[
axis
];
auto
len
=
input
.
lens
()[
axis
];
if
(
stride
!=
0
and
stride
!=
1
)
if
(
not
contains
({
0
,
1
},
stride
)
)
return
1
;
return
1
;
if
(
len
==
1
and
input
.
elements
()
>
sizes
.
front
())
if
(
len
==
1
and
input
.
elements
()
>
sizes
.
front
())
return
sizes
.
front
();
return
sizes
.
front
();
auto
it
=
std
::
find_if
(
auto
it
=
std
::
find_if
(
sizes
.
begin
(),
sizes
.
end
(),
[
&
](
auto
i
)
{
return
(
len
%
i
)
==
0
;
});
sizes
.
begin
(),
sizes
.
end
(),
[
&
](
auto
vsize
)
{
// The len is divisible by the size and all the strides are divisible by the size
return
(
len
%
vsize
)
==
0
and
std
::
all_of
(
input
.
strides
().
begin
(),
input
.
strides
().
end
(),
[
&
](
auto
i
)
{
return
contains
({
0
,
1
},
i
)
or
i
%
vsize
==
0
;
});
});
if
(
it
!=
sizes
.
end
())
if
(
it
!=
sizes
.
end
())
return
*
it
;
return
*
it
;
return
1
;
return
1
;
...
...
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