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
6f96cf7e
"git@developer.sourcefind.cn:chenpangpang/parler-tts.git" did not exist on "59d717e604656188c261fa018b3382e236fd6fcf"
Commit
6f96cf7e
authored
Aug 23, 2018
by
Paul
Browse files
Formatting
parent
cff1144d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
27 deletions
+21
-27
src/targets/gpu/device/add_relu.cpp
src/targets/gpu/device/add_relu.cpp
+1
-3
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
+11
-13
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
+9
-11
No files found.
src/targets/gpu/device/add_relu.cpp
View file @
6f96cf7e
...
@@ -7,9 +7,7 @@ namespace device {
...
@@ -7,9 +7,7 @@ namespace device {
void
add_relu
(
argument
arg1
,
argument
arg2
,
argument
result
)
void
add_relu
(
argument
arg1
,
argument
arg2
,
argument
result
)
{
{
binary_standard
(
arg1
,
arg2
,
result
,
[](
auto
x
,
auto
y
)
{
binary_standard
(
arg1
,
arg2
,
result
,
[](
auto
x
,
auto
y
)
{
return
max
(
0
,
x
+
y
);
});
return
max
(
0
,
x
+
y
);
});
}
}
}
// namespace device
}
// namespace device
...
...
src/targets/gpu/device/include/migraph/gpu/device/binary.hpp
View file @
6f96cf7e
...
@@ -8,7 +8,7 @@ namespace migraph {
...
@@ -8,7 +8,7 @@ namespace migraph {
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
template
<
class
F
>
template
<
class
F
>
void
binary
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
void
binary
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
{
if
(
x
.
get_shape
().
standard
())
if
(
x
.
get_shape
().
standard
())
...
@@ -17,7 +17,7 @@ void binary(argument x, argument y, argument result, F f)
...
@@ -17,7 +17,7 @@ void binary(argument x, argument y, argument result, F f)
binary_nonstandard
(
x
,
y
,
result
,
f
);
binary_nonstandard
(
x
,
y
,
result
,
f
);
}
}
template
<
class
F
>
template
<
class
F
>
void
binary_nonstandard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
void
binary_nonstandard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
{
auto
output_shape
=
result
.
get_shape
();
auto
output_shape
=
result
.
get_shape
();
...
@@ -40,7 +40,7 @@ void binary_nonstandard(argument x, argument y, argument result, F f)
...
@@ -40,7 +40,7 @@ void binary_nonstandard(argument x, argument y, argument result, F f)
});
});
}
}
template
<
class
F
>
template
<
class
F
>
void
binary_standard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
void
binary_standard
(
argument
x
,
argument
y
,
argument
result
,
F
f
)
{
{
assert
(
x
.
get_shape
().
elements
()
==
y
.
get_shape
().
elements
());
assert
(
x
.
get_shape
().
elements
()
==
y
.
get_shape
().
elements
());
...
@@ -50,9 +50,7 @@ void binary_standard(argument x, argument y, argument result, F f)
...
@@ -50,9 +50,7 @@ void binary_standard(argument x, argument y, argument result, F f)
auto
*
xp
=
input1
.
data
();
auto
*
xp
=
input1
.
data
();
auto
*
yp
=
input2
.
data
();
auto
*
yp
=
input2
.
data
();
auto
*
outp
=
output
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
outp
[
i
]
=
f
(
xp
[
i
],
yp
[
i
]);
});
outp
[
i
]
=
f
(
xp
[
i
],
yp
[
i
]);
});
});
});
}
}
...
...
src/targets/gpu/device/include/migraph/gpu/device/unary.hpp
View file @
6f96cf7e
...
@@ -9,7 +9,7 @@ namespace migraph {
...
@@ -9,7 +9,7 @@ namespace migraph {
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
template
<
class
F
>
template
<
class
F
>
void
unary
(
argument
x
,
argument
result
,
F
f
)
void
unary
(
argument
x
,
argument
result
,
F
f
)
{
{
if
(
x
.
get_shape
().
standard
())
if
(
x
.
get_shape
().
standard
())
...
@@ -18,7 +18,7 @@ void unary(argument x, argument result, F f)
...
@@ -18,7 +18,7 @@ void unary(argument x, argument result, F f)
unary_nonstandard
(
x
,
result
,
f
);
unary_nonstandard
(
x
,
result
,
f
);
}
}
template
<
class
F
>
template
<
class
F
>
void
unary_nonstandard
(
argument
x
,
argument
result
,
F
f
)
void
unary_nonstandard
(
argument
x
,
argument
result
,
F
f
)
{
{
auto
output_shape
=
result
.
get_shape
();
auto
output_shape
=
result
.
get_shape
();
...
@@ -37,7 +37,7 @@ void unary_nonstandard(argument x, argument result, F f)
...
@@ -37,7 +37,7 @@ void unary_nonstandard(argument x, argument result, F f)
});
});
}
}
template
<
class
F
>
template
<
class
F
>
void
unary_standard
(
argument
x
,
argument
result
,
F
f
)
void
unary_standard
(
argument
x
,
argument
result
,
F
f
)
{
{
auto
output_shape
=
result
.
get_shape
();
auto
output_shape
=
result
.
get_shape
();
...
@@ -45,9 +45,7 @@ void unary_standard(argument x, argument result, F f)
...
@@ -45,9 +45,7 @@ void unary_standard(argument x, argument result, F f)
visit_all
(
result
,
x
)([
&
](
auto
output
,
auto
input
)
{
visit_all
(
result
,
x
)([
&
](
auto
output
,
auto
input
)
{
auto
*
xp
=
input
.
data
();
auto
*
xp
=
input
.
data
();
auto
*
outp
=
output
.
data
();
auto
*
outp
=
output
.
data
();
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
gs_launch
(
input_shape
.
elements
())([
=
](
auto
i
)
{
outp
[
i
]
=
f
(
xp
[
i
]);
});
outp
[
i
]
=
f
(
xp
[
i
]);
});
});
});
}
}
...
...
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