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
4d0fdcd5
Commit
4d0fdcd5
authored
Aug 15, 2018
by
Paul
Browse files
Add flatten operator
parent
a29f3d94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
src/include/migraph/operators.hpp
src/include/migraph/operators.hpp
+21
-1
No files found.
src/include/migraph/operators.hpp
View file @
4d0fdcd5
...
...
@@ -422,9 +422,29 @@ struct neg : unary
struct
flatten
{
uint64_t
axis
=
0
;
std
::
string
name
()
const
{
return
"flatten"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
check_shapes
{
inputs
}.
has
(
1
);
if
(
axis
==
0
)
{
return
{
inputs
.
at
(
0
).
type
(),
{
1
,
inputs
.
at
(
0
).
elements
()}};
}
if
(
axis
==
1
)
{
return
{
inputs
.
at
(
0
).
type
(),
{
inputs
.
at
(
0
).
elements
(),
1
}};
}
else
{
MIGRAPH_THROW
(
"axis for flatten can only be either 0 or 1"
);
}
}
argument
compute
(
context
&
,
shape
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
return
{
output_shape
,
std
::
move
(
args
.
front
().
data
)};
}
};
struct
broadcast
{
uint64_t
axis
=
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