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
86cf29ed
"docs/vscode:/vscode.git/clone" did not exist on "12a5e3de1c4b3e017286b68a5334a1e49870f0f5"
Commit
86cf29ed
authored
Dec 28, 2022
by
charlie
Browse files
Formatting
parent
8ad792f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
src/include/migraphx/op/reshape.hpp
src/include/migraphx/op/reshape.hpp
+1
-1
test/op_shape_test.cpp
test/op_shape_test.cpp
+10
-6
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+2
-2
No files found.
src/include/migraphx/op/reshape.hpp
View file @
86cf29ed
...
...
@@ -56,7 +56,7 @@ struct reshape
auto
s0
=
inputs
[
0
];
if
(
s0
.
dynamic
())
{
auto
dyn_dims
=
s0
.
dyn_dims
();
auto
dyn_dims
=
s0
.
dyn_dims
();
int
not_fixed_index
=
-
1
;
// track number of fixed elements in input and output
std
::
size_t
num_dims_ele
=
1
;
...
...
test/op_shape_test.cpp
View file @
86cf29ed
...
...
@@ -1986,9 +1986,10 @@ TEST_CASE(reshape_shape)
TEST_CASE
(
reshape_dyn_shape
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
1
,
1
,
0
},
{
1
,
1
,
0
}}};
for
(
auto
&&
new_shape
:
std
::
vector
<
std
::
vector
<
int64_t
>>
{{
-
1
,
1
,
1
,
24
},
{
0
,
8
,
3
,
1
},
{
-
1
,
3
,
4
,
2
},
{
0
,
2
,
4
,
3
}})
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
1
,
1
,
0
},
{
1
,
1
,
0
}}};
for
(
auto
&&
new_shape
:
std
::
vector
<
std
::
vector
<
int64_t
>>
{
{
-
1
,
1
,
1
,
24
},
{
0
,
8
,
3
,
1
},
{
-
1
,
3
,
4
,
2
},
{
0
,
2
,
4
,
3
}})
{
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
out_dyn_dims
{};
for
(
std
::
size_t
i
=
0
;
i
<
new_shape
.
size
();
++
i
)
...
...
@@ -2010,21 +2011,24 @@ TEST_CASE(reshape_dyn_shape)
TEST_CASE
(
reshape_multiple_non_fixed_error
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
10
,
20
,
0
},
{
1
,
1
,
0
}}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
10
,
20
,
0
},
{
1
,
1
,
0
}}};
std
::
vector
<
int64_t
>
new_shape
=
{
0
,
1
,
0
,
24
};
throws_shape
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
new_shape
}}),
input
);
}
TEST_CASE
(
reshape_fixed_ele_not_matching_error
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
10
,
10
,
0
},
{
1
,
1
,
0
}}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
10
,
10
,
0
},
{
1
,
1
,
0
}}};
std
::
vector
<
int64_t
>
new_shape
=
{
0
,
1
,
5
,
24
};
throws_shape
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
new_shape
}}),
input
);
}
TEST_CASE
(
reshape_non_fixed_not_matching_error
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
1
,
1
,
0
},
{
1
,
1
,
0
}}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
24
,
24
,
0
},
{
1
,
1
,
0
},
{
1
,
1
,
0
}}};
std
::
vector
<
int64_t
>
new_shape
=
{
2
,
1
,
1
,
24
};
throws_shape
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
new_shape
}}),
input
);
}
...
...
test/ref_ops_test.cpp
View file @
86cf29ed
...
...
@@ -6102,10 +6102,10 @@ TEST_CASE(reshape_dyn_test)
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {{1, 4, 0}, {24, 24, 0}, {1, 1, 0}, {1, 1, 0}}};
std::vector<int64_t> new_shape = {0, 8, 3, 1};
auto input = mm->add_parameter("X", s);
auto input
= mm->add_parameter("X", s);
mm->add_instruction(migraphx::make_op("reshape", {{"dims", new_shape}}), input);
p.compile(migraphx::ref::target{});
std::vector<float> data(48);
std::iota(data.begin(), data.end(), -3);
migraphx::parameter_map params;
...
...
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