Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
042a9437
Commit
042a9437
authored
May 02, 2019
by
Shucai Xiao
Browse files
code cleanup
parent
ef5d7092
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
15 deletions
+25
-15
src/include/migraphx/op/binary.hpp
src/include/migraphx/op/binary.hpp
+5
-3
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+11
-6
src/targets/gpu/include/migraphx/gpu/oper.hpp
src/targets/gpu/include/migraphx/gpu/oper.hpp
+9
-6
No files found.
src/include/migraphx/op/binary.hpp
View file @
042a9437
...
...
@@ -13,13 +13,15 @@ struct binary : op_name<Derived>
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
check_shapes
{
inputs
}.
has
(
2
).
same_type
().
same_dims
();
if
(
inputs
.
at
(
0
)
==
inputs
.
at
(
1
)
and
inputs
.
at
(
0
).
packed
())
auto
s0
=
inputs
.
at
(
0
);
auto
s1
=
inputs
.
at
(
1
);
if
(
s0
==
s1
and
s0
.
packed
())
{
return
inputs
.
at
(
0
)
;
return
s0
;
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
)
.
lens
()};
return
{
s0
.
type
(),
s0
.
lens
()};
}
}
argument
compute
(
const
shape
&
output_shape
,
std
::
vector
<
argument
>
args
)
const
...
...
src/targets/cpu/lowering.cpp
View file @
042a9437
...
...
@@ -593,13 +593,15 @@ struct cpu_unary
std
::
string
name
()
const
{
return
op
.
name
();
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
if
(
inputs
.
at
(
0
).
packed
())
check_shapes
{
inputs
}.
has
(
1
);
auto
s
=
inputs
.
at
(
0
);
if
(
s
.
packed
())
{
return
inputs
.
at
(
0
)
;
return
s
;
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
)
.
lens
()};
return
{
s
.
type
(),
s
.
lens
()};
}
}
...
...
@@ -793,13 +795,16 @@ struct cpu_binary
std
::
string
name
()
const
{
return
"cpu::"
+
op
.
name
();
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
if
(
inputs
.
at
(
0
)
==
inputs
.
at
(
1
)
and
inputs
.
at
(
0
).
packed
())
check_shapes
{
inputs
}.
has
(
2
).
same_type
().
same_dims
();
auto
s0
=
inputs
.
at
(
0
);
auto
s1
=
inputs
.
at
(
1
);
if
(
s0
==
s1
and
s0
.
packed
())
{
return
inputs
.
at
(
0
)
;
return
s0
;
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
)
.
lens
()};
return
{
s0
.
type
(),
s0
.
lens
()};
}
}
...
...
src/targets/gpu/include/migraphx/gpu/oper.hpp
View file @
042a9437
...
...
@@ -45,13 +45,14 @@ struct unary_device : oper<Derived>
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
if
(
inputs
.
at
(
0
).
packed
())
auto
s
=
inputs
.
at
(
0
);
if
(
s
.
packed
())
{
return
inputs
.
at
(
0
)
;
return
s
;
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
)
.
lens
()};
return
{
s
.
type
(),
s
.
lens
()};
}
}
...
...
@@ -73,13 +74,15 @@ struct binary_device : oper<Derived>
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
if
(
inputs
.
at
(
0
)
==
inputs
.
at
(
1
)
and
inputs
.
at
(
0
).
packed
())
auto
s0
=
inputs
.
at
(
0
);
auto
s1
=
inputs
.
at
(
1
);
if
(
s0
==
s1
and
s0
.
packed
())
{
return
inputs
.
at
(
0
)
;
return
s0
;
}
else
{
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
)
.
lens
()};
return
{
s0
.
type
(),
s0
.
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