Commit 3a9d3134 authored by Jing Zhang's avatar Jing Zhang
Browse files

fixed comments

parent 3a6c595e
...@@ -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);
}; };
}; };
......
...@@ -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.0f; float beta_ = 1.0f;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment