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
5e36c210
"...git@developer.sourcefind.cn:OpenDAS/mmdetection3d.git" did not exist on "fc9e0d9dab0c0cfc14241b990c1cce6ea7a750c0"
Commit
5e36c210
authored
Apr 23, 2019
by
Shucai Xiao
Browse files
minor additional changes for improving the eliminate contiguous.
parent
6626861d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
20 deletions
+8
-20
src/eliminate_contiguous.cpp
src/eliminate_contiguous.cpp
+6
-4
src/include/migraphx/op/binary.hpp
src/include/migraphx/op/binary.hpp
+1
-8
src/include/migraphx/op/unary.hpp
src/include/migraphx/op/unary.hpp
+1
-8
No files found.
src/eliminate_contiguous.cpp
View file @
5e36c210
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
bool
try_compute_shape
(
instruction_ref
ins
,
const
std
::
vector
<
shape
>&
inputs
)
static
bool
try_compute_shape
(
instruction_ref
ins
,
const
std
::
vector
<
shape
>&
inputs
)
{
{
try
try
{
{
...
@@ -21,8 +21,10 @@ bool try_compute_shape(instruction_ref ins, const std::vector<shape>& inputs)
...
@@ -21,8 +21,10 @@ bool try_compute_shape(instruction_ref ins, const std::vector<shape>& inputs)
}
}
auto
outputs
=
ins
->
outputs
();
auto
outputs
=
ins
->
outputs
();
// If the current instruction has no output, it means the last output shape
// If the current instruction has no output, it means it is the last
// is non-standard, then we cannot eliminate the contiguous
// instruction and generates a non-standard output. But for unary
// and binary operators, we can still remove it and reshape the output
// to be standard since these operator can handle non-standard inputs
if
(
outputs
.
empty
())
if
(
outputs
.
empty
())
{
{
return
true
;
return
true
;
...
@@ -51,7 +53,7 @@ bool try_compute_shape(instruction_ref ins, const std::vector<shape>& inputs)
...
@@ -51,7 +53,7 @@ bool try_compute_shape(instruction_ref ins, const std::vector<shape>& inputs)
return
true
;
return
true
;
}
}
bool
try_compute_shape
(
instruction_ref
ins
,
const
std
::
vector
<
instruction_ref
>&
args
)
static
bool
try_compute_shape
(
instruction_ref
ins
,
const
std
::
vector
<
instruction_ref
>&
args
)
{
{
auto
inputs
=
to_shapes
(
args
);
auto
inputs
=
to_shapes
(
args
);
return
try_compute_shape
(
ins
,
inputs
);
return
try_compute_shape
(
ins
,
inputs
);
...
...
src/include/migraphx/op/binary.hpp
View file @
5e36c210
...
@@ -21,14 +21,7 @@ struct binary
...
@@ -21,14 +21,7 @@ struct binary
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
{
check_shapes
{
inputs
}.
has
(
2
).
same_type
().
same_dims
();
check_shapes
{
inputs
}.
has
(
2
).
same_type
().
same_dims
();
if
(
inputs
.
at
(
0
)
==
inputs
.
at
(
1
)
and
inputs
.
at
(
0
).
packed
()
and
inputs
.
at
(
1
).
packed
())
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
{
return
inputs
.
at
(
0
);
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
}
}
}
};
};
...
...
src/include/migraphx/op/unary.hpp
View file @
5e36c210
...
@@ -21,14 +21,7 @@ struct unary
...
@@ -21,14 +21,7 @@ struct unary
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
{
check_shapes
{
inputs
}.
has
(
1
);
check_shapes
{
inputs
}.
has
(
1
);
if
(
inputs
.
front
().
packed
())
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
{
return
inputs
.
at
(
0
);
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()};
}
}
}
};
};
...
...
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