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
composable_kernel
Commits
3a9d3134
Commit
3a9d3134
authored
Sep 08, 2023
by
Jing Zhang
Browse files
fixed comments
parent
3a6c595e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
example/42_groupnorm/groupnorm_sigmoid_mul_fp16.cpp
example/42_groupnorm/groupnorm_sigmoid_mul_fp16.cpp
+5
-1
include/ck/tensor_operation/gpu/element/unary_element_wise_operation.hpp
...or_operation/gpu/element/unary_element_wise_operation.hpp
+7
-2
No files found.
example/42_groupnorm/groupnorm_sigmoid_mul_fp16.cpp
View file @
3a9d3134
...
@@ -21,11 +21,15 @@ struct YElementOp
...
@@ -21,11 +21,15 @@ struct YElementOp
ck
::
is_same
<
X
,
ck
::
half_t
>::
value
,
ck
::
is_same
<
X
,
ck
::
half_t
>::
value
,
"Data type is not supported by this operation!"
);
"Data type is not supported by this operation!"
);
static_assert
(
ck
::
is_same
<
Y
,
float
>::
value
||
ck
::
is_same
<
Y
,
double
>::
value
||
ck
::
is_same
<
Y
,
ck
::
half_t
>::
value
,
"Data type is not supported by this operation!"
);
X
a
;
X
a
;
ck
::
tensor_operation
::
element_wise
::
Sigmoid
{}(
a
,
x
);
ck
::
tensor_operation
::
element_wise
::
Sigmoid
{}(
a
,
x
);
y
=
x
*
a
;
y
=
ck
::
type_convert
<
Y
>
(
x
*
a
)
;
};
};
};
};
...
...
include/ck/tensor_operation/gpu/element/unary_element_wise_operation.hpp
View file @
3a9d3134
...
@@ -30,7 +30,7 @@ struct PassThrough
...
@@ -30,7 +30,7 @@ struct PassThrough
template
<
>
template
<
>
__host__
__device__
void
operator
()
<
float
,
double
>
(
float
&
y
,
const
double
&
x
)
const
__host__
__device__
void
operator
()
<
float
,
double
>
(
float
&
y
,
const
double
&
x
)
const
{
{
y
=
x
;
y
=
type_convert
<
float
>
(
x
)
;
}
}
template
<
>
template
<
>
...
@@ -431,7 +431,12 @@ struct Swish
...
@@ -431,7 +431,12 @@ struct Swish
is_same
<
X
,
ck
::
half_t
>::
value
,
is_same
<
X
,
ck
::
half_t
>::
value
,
"Data type is not supported by this operation!"
);
"Data type is not supported by this operation!"
);
y
=
x
/
(
ck
::
type_convert
<
Y
>
(
1
)
+
ck
::
math
::
exp
(
-
beta_
*
x
));
static_assert
(
is_same
<
Y
,
float
>::
value
||
is_same
<
Y
,
double
>::
value
||
is_same
<
Y
,
ck
::
half_t
>::
value
,
"Data type is not supported by this operation!"
);
float
bx
=
-
beta_
*
type_convert
<
float
>
(
x
);
y
=
type_convert
<
Y
>
(
x
/
(
1.
f
+
ck
::
math
::
exp
(
bx
)));
};
};
float
beta_
=
1.0
f
;
float
beta_
=
1.0
f
;
...
...
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