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
c2c7f497
Commit
c2c7f497
authored
Jun 13, 2022
by
Paul
Browse files
Format
parent
3101f6fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
src/include/migraphx/op/unsqueeze.hpp
src/include/migraphx/op/unsqueeze.hpp
+5
-5
test/op_shape_test.cpp
test/op_shape_test.cpp
+0
-1
No files found.
src/include/migraphx/op/unsqueeze.hpp
View file @
c2c7f497
...
@@ -62,21 +62,21 @@ struct unsqueeze
...
@@ -62,21 +62,21 @@ struct unsqueeze
if
(
axis_idx
<
axes
.
size
())
if
(
axis_idx
<
axes
.
size
())
{
{
std
::
int64_t
step
=
1
;
std
::
int64_t
step
=
1
;
if
(
axis_idx
<
steps
.
size
())
if
(
axis_idx
<
steps
.
size
())
step
=
steps
[
axis_idx
];
step
=
steps
[
axis_idx
];
if
(
step
==
0
)
if
(
step
==
0
)
MIGRAPHX_THROW
(
"UNSQUEEZE: step must be non-zero"
);
MIGRAPHX_THROW
(
"UNSQUEEZE: step must be non-zero"
);
new_lens
[
i
]
=
step
;
new_lens
[
i
]
=
step
;
if
(
p
<
old_strides
.
size
())
if
(
p
<
old_strides
.
size
())
{
{
if
((
old_lens
[
p
]
%
step
)
!=
0
)
if
((
old_lens
[
p
]
%
step
)
!=
0
)
MIGRAPHX_THROW
(
"UNSQUEEZE: Axis dimenstion is not divisible by step"
);
MIGRAPHX_THROW
(
"UNSQUEEZE: Axis dimenstion is not divisible by step"
);
old_lens
[
p
]
/=
step
;
old_lens
[
p
]
/=
step
;
new_strides
[
i
]
=
old_strides
[
p
]
*
old_lens
[
p
];
new_strides
[
i
]
=
old_strides
[
p
]
*
old_lens
[
p
];
}
}
else
else
{
{
if
(
step
!=
1
)
if
(
step
!=
1
)
MIGRAPHX_THROW
(
"UNSQUEEZE: Step must be 1 for extra axes"
);
MIGRAPHX_THROW
(
"UNSQUEEZE: Step must be 1 for extra axes"
);
new_strides
[
i
]
=
1
;
new_strides
[
i
]
=
1
;
}
}
...
...
test/op_shape_test.cpp
View file @
c2c7f497
...
@@ -1580,7 +1580,6 @@ TEST_CASE(test_unsqueeze_transpose_step)
...
@@ -1580,7 +1580,6 @@ TEST_CASE(test_unsqueeze_transpose_step)
expect_shape
(
s2
,
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
2
}},
{
"steps"
,
{
2
}}}),
s1
);
expect_shape
(
s2
,
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
2
}},
{
"steps"
,
{
2
}}}),
s1
);
}
}
TEST_CASE
(
test_unsqueeze_multibroadcast
)
TEST_CASE
(
test_unsqueeze_multibroadcast
)
{
{
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
},
{
0
,
1
,
0
}};
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
},
{
0
,
1
,
0
}};
...
...
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