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
1329b9be
"src/vscode:/vscode.git/clone" did not exist on "da011b99b19749ecf23c39bf8aca52936f66d1ea"
Unverified
Commit
1329b9be
authored
Apr 03, 2023
by
shivadbhavsar
Committed by
GitHub
Apr 03, 2023
Browse files
fix stable diffusion decoder non standard shape issue (#1594)
parent
e3fb3a0d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
+24
-6
src/include/migraphx/op/contiguous.hpp
src/include/migraphx/op/contiguous.hpp
+1
-1
src/onnx/parse_reshape.cpp
src/onnx/parse_reshape.cpp
+2
-2
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+4
-2
test/op_shape_test.cpp
test/op_shape_test.cpp
+8
-1
test/shape_test.cpp
test/shape_test.cpp
+9
-0
No files found.
src/include/migraphx/op/contiguous.hpp
View file @
1329b9be
...
...
@@ -48,7 +48,7 @@ struct contiguous
{
check_shapes
{
inputs
,
*
this
,
true
}.
has
(
1
);
auto
s0
=
inputs
.
front
();
if
(
s0
.
dynamic
()
or
s0
.
standard
()
)
if
(
s0
.
dynamic
())
{
return
s0
;
}
...
...
src/onnx/parse_reshape.cpp
View file @
1329b9be
...
...
@@ -53,8 +53,8 @@ struct parse_reshape : op_parser<parse_reshape>
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
dims
));
});
}
return
info
.
add_instruction
(
make_op
(
"
reshape"
,
{{
"dim
s"
,
dims
}}),
info
.
make_contiguous
(
args
[
0
])
);
auto
cont
=
info
.
add_instruction
(
make_op
(
"
contiguou
s"
)
,
args
[
0
]);
return
info
.
add_instruction
(
make_op
(
"reshape"
,
{{
"dims"
,
dims
}}),
cont
);
}
};
...
...
test/onnx/onnx_test.cpp
View file @
1329b9be
...
...
@@ -5116,8 +5116,10 @@ TEST_CASE(reshape_test)
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}},
reshape_dims
});
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
2
,
3
}});
op
.
dims
=
reshape_dims
;
mm
->
add_instruction
(
op
,
l0
);
mm
->
add_instruction
(
op
,
l0
);
auto
c0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
l0
);
mm
->
add_instruction
(
op
,
c0
);
auto
c1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
l0
);
mm
->
add_instruction
(
op
,
c1
);
auto
prog
=
optimize_onnx
(
"reshape_test.onnx"
);
EXPECT
(
p
==
prog
);
...
...
test/op_shape_test.cpp
View file @
1329b9be
...
...
@@ -431,11 +431,18 @@ TEST_CASE(contiguous_dyn_shape)
TEST_CASE
(
contiguous_shape_scalar
)
{
migraphx
::
shape
output
{
migraphx
::
shape
::
float_type
};
migraphx
::
shape
output
{
migraphx
::
shape
::
float_type
,
{
1
}
};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
};
expect_shape
(
output
,
migraphx
::
make_op
(
"contiguous"
),
input
);
}
TEST_CASE
(
contiguous_shape_singleton_dim
)
{
migraphx
::
shape
output
{
migraphx
::
shape
::
float_type
,
{
5
,
1
,
8
},
{
8
,
8
,
1
}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
5
,
1
,
8
},
{
8
,
4
,
1
}};
expect_shape
(
output
,
migraphx
::
make_op
(
"contiguous"
),
input
);
}
TEST_CASE
(
deconvolution_shape
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
1
,
1
}};
...
...
test/shape_test.cpp
View file @
1329b9be
...
...
@@ -85,6 +85,15 @@ TEST_CASE(test_shape_standard)
EXPECT
(
not
s
.
broadcasted
());
}
TEST_CASE
(
test_shape_standard_singleton_dim
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
5
,
1
,
8
},
{
8
,
4
,
1
}};
EXPECT
(
s
.
standard
());
EXPECT
(
s
.
packed
());
EXPECT
(
not
s
.
transposed
());
EXPECT
(
not
s
.
broadcasted
());
}
TEST_CASE
(
test_shape_min_max_opt
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
3
},
{
6
,
3
,
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