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
6690765c
"src/vscode:/vscode.git/clone" did not exist on "05affc68e71945f1efbafa5932f5c3811202284c"
Commit
6690765c
authored
Apr 14, 2023
by
Paul
Browse files
Fix conflicts
parent
2fc6b715
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
97 deletions
+0
-97
src/include/migraphx/op/reshape.hpp
src/include/migraphx/op/reshape.hpp
+0
-90
test/op_shape_test.cpp
test/op_shape_test.cpp
+0
-7
No files found.
src/include/migraphx/op/reshape.hpp
View file @
6690765c
...
...
@@ -116,10 +116,7 @@ struct reshape
StrideIterator
stride_start
,
StrideIterator
stride_last
)
{
<<<<<<<
HEAD
=======
assert
(
std
::
distance
(
dim_start
,
dim_last
)
==
std
::
distance
(
stride_start
,
stride_last
));
>>>>>>>
origin
/
reshape
-
nonstandard
auto
cstride
=
*
std
::
prev
(
stride_last
);
return
std
::
equal
(
std
::
make_reverse_iterator
(
dim_last
),
std
::
make_reverse_iterator
(
dim_start
+
1
),
...
...
@@ -131,13 +128,6 @@ struct reshape
});
}
<<<<<<<
HEAD
shape
static_compute_shape
(
std
::
vector
<
shape
>
inputs
,
std
::
size_t
n_neg_dims
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
1
);
auto
&&
idims
=
inputs
.
front
().
lens
();
auto
&&
istrides
=
inputs
.
front
().
strides
();
=======
static
optional
<
shape
>
reshape_dims
(
const
shape
&
input
,
const
std
::
vector
<
std
::
size_t
>&
rdims
)
{
if
(
input
.
standard
())
...
...
@@ -217,7 +207,6 @@ struct reshape
check_shapes
{
inputs
,
*
this
}.
has
(
1
);
auto
&&
idims
=
inputs
.
front
().
lens
();
// auto&& istrides = inputs.front().strides();
>>>>>>>
origin
/
reshape
-
nonstandard
std
::
vector
<
std
::
size_t
>
rdims
(
dims
.
begin
(),
dims
.
end
());
for
(
std
::
size_t
i
=
0
;
i
<
dims
.
size
();
i
++
)
...
...
@@ -243,90 +232,11 @@ struct reshape
}
}
<<<<<<<
HEAD
shape
s
;
if
(
inputs
.
front
().
standard
())
{
s
=
shape
{
inputs
.
front
().
type
(),
rdims
};
}
else
{
std
::
vector
<
std
::
size_t
>
rstrides
;
std
::
size_t
i
=
0
;
std
::
size_t
r
=
0
;
while
(
i
<
idims
.
size
()
and
r
<
rdims
.
size
())
{
auto
idim
=
idims
[
i
];
auto
rdim
=
rdims
[
r
];
if
(
rdim
==
idim
)
{
rstrides
.
push_back
(
istrides
[
i
]);
}
// squeeze
else
if
(
rdim
>
idim
)
{
auto
start
=
idims
.
begin
()
+
i
;
auto
it
=
compute_end_dim
(
start
,
idims
.
end
(),
rdim
);
if
(
it
==
start
)
break
;
auto
n
=
it
-
start
;
if
((
i
+
n
)
>
istrides
.
size
())
break
;
if
(
not
can_strides_merge
(
start
,
it
+
1
,
istrides
.
begin
()
+
i
,
istrides
.
begin
()
+
i
+
n
))
break
;
i
+=
n
;
rstrides
.
push_back
(
istrides
[
i
]);
}
// unsqueeze
else
if
(
rdim
<
idim
)
{
auto
start
=
rdims
.
begin
()
+
i
;
auto
it
=
compute_end_dim
(
start
,
rdims
.
end
(),
idim
);
if
(
it
==
start
)
break
;
auto
n
=
it
-
start
;
if
((
r
+
n
)
>
rdims
.
size
())
break
;
auto
stride
=
istrides
[
i
]
*
idim
;
std
::
for_each
(
start
,
it
+
1
,
[
&
](
auto
dim
)
{
stride
/=
dim
;
rstrides
.
push_back
(
stride
);
});
r
+=
n
;
}
i
++
;
r
++
;
}
// Handle trailing 1s
if
(
rstrides
.
size
()
<
rdims
.
size
()
and
not
rstrides
.
empty
())
{
auto
stride
=
rstrides
.
back
();
for
(
auto
d
:
range
(
rdims
.
begin
()
+
rstrides
.
size
(),
rdims
.
end
()))
{
if
(
d
!=
1
)
break
;
rstrides
.
push_back
(
stride
);
}
}
if
(
rdims
.
size
()
!=
rstrides
.
size
())
MIGRAPHX_THROW
(
"Reshape on axis that is not standard"
);
s
=
shape
{
inputs
.
front
().
type
(),
rdims
,
rstrides
};
}
assert
(
s
.
bytes
()
==
inputs
.
front
().
bytes
());
if
(
s
.
elements
()
!=
inputs
.
front
().
elements
())
=======
auto
s
=
reshape_dims
(
inputs
.
front
(),
rdims
);
if
(
not
s
.
has_value
())
MIGRAPHX_THROW
(
"Reshape on axis that is not packed."
);
if
(
s
->
elements
()
!=
inputs
.
front
().
elements
())
>>>>>>>
origin
/
reshape
-
nonstandard
MIGRAPHX_THROW
(
"Reshape: Wrong number of elements for reshape: reshape has "
+
std
::
to_string
(
s
->
elements
())
+
" elements whereas the input has "
+
std
::
to_string
(
inputs
.
front
().
elements
()));
...
...
test/op_shape_test.cpp
View file @
6690765c
...
...
@@ -2183,11 +2183,7 @@ TEST_CASE(reshape_shape)
}
}
<<<<<<<
HEAD
TEST_CASE
(
reshape_nonstandard_unsqeeze
)
=======
TEST_CASE(reshape_nonstandard_unsqueeze)
>>>>>>>
origin
/
reshape
-
nonstandard
{
migraphx::shape input{migraphx::shape::float_type, {4, 24, 1, 1, 1}, {1, 4, 1, 1, 1}};
std::vector<std::size_t> lens = {4, 1, 3, 4, 2};
...
...
@@ -2197,8 +2193,6 @@ TEST_CASE(reshape_nonstandard_unsqueeze)
expect_shape(output, migraphx::make_op("reshape", {{"dims", lens}}), input);
}
<<<<<<<
HEAD
=======
TEST_CASE(reshape_nonstandard_squeeze)
{
migraphx::shape input{migraphx::shape::float_type, {2, 16, 16, 1280}, {327680, 16, 1, 256}};
...
...
@@ -2216,7 +2210,6 @@ TEST_CASE(reshape_broadcast_squeeze)
expect_shape(output, migraphx::make_op("reshape", {{"dims", output.lens()}}), input);
}
>>>>>>>
origin
/
reshape
-
nonstandard
TEST_CASE(reshape_dyn_shape)
{
migraphx::shape input{migraphx::shape::float_type, {{1, 4}, {24, 24}, {1, 1}, {1, 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