mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Initial support for taking the power of fp16
This commit is contained in:
parent
3394379319
commit
8d22967bd9
@ -406,6 +406,9 @@ template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half log(const Eigen::ha
|
|||||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrt(const Eigen::half& a) {
|
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrt(const Eigen::half& a) {
|
||||||
return Eigen::half(::sqrtf(float(a)));
|
return Eigen::half(::sqrtf(float(a)));
|
||||||
}
|
}
|
||||||
|
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half pow(const Eigen::half& a, const Eigen::half& b) {
|
||||||
|
return Eigen::half(::powf(float(a), float(b)));
|
||||||
|
}
|
||||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half floor(const Eigen::half& a) {
|
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half floor(const Eigen::half& a) {
|
||||||
return Eigen::half(::floorf(float(a)));
|
return Eigen::half(::floorf(float(a)));
|
||||||
}
|
}
|
||||||
@ -432,6 +435,9 @@ static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half logh(const Eigen::half&
|
|||||||
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrth(const Eigen::half& a) {
|
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrth(const Eigen::half& a) {
|
||||||
return Eigen::half(::sqrtf(float(a)));
|
return Eigen::half(::sqrtf(float(a)));
|
||||||
}
|
}
|
||||||
|
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half powh(const Eigen::half& a, const Eigen::half& b) {
|
||||||
|
return Eigen::half(::powf(float(a), float(b)));
|
||||||
|
}
|
||||||
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half floorh(const Eigen::half& a) {
|
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half floorh(const Eigen::half& a) {
|
||||||
return Eigen::half(::floorf(float(a)));
|
return Eigen::half(::floorf(float(a)));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user