Made isinf, isnan, isfinite, ceil and floor work with 16 bit floats.
Change: 119458778
This commit is contained in:
parent
8f8b8d6ddc
commit
cc9560e8f4
@ -1,6 +1,6 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
archive_dir = "eigen-eigen-e217e6eb56bf"
|
||||
archive_dir = "eigen-eigen-3f653ace7d28"
|
||||
|
||||
cc_library(
|
||||
name = "eigen",
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
include (ExternalProject)
|
||||
|
||||
set(eigen_archive_hash "e217e6eb56bf")
|
||||
set(eigen_archive_hash "3f653ace7d28")
|
||||
|
||||
set(eigen_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
@ -16,7 +16,7 @@ set(eigen_INCLUDE_DIRS
|
||||
${tensorflow_source_dir}/third_party/eigen3
|
||||
)
|
||||
set(eigen_URL https://bitbucket.org/eigen/eigen/get/${eigen_archive_hash}.tar.gz)
|
||||
set(eigen_HASH SHA256=79e85cfbb9776c63ea32021bffd4ddc33914c984354c0a9c8a649b17b788cf41)
|
||||
set(eigen_HASH SHA256=b49502f423deda55cea33bc503f84409cca92157f3b536d17113b81138f86715)
|
||||
set(eigen_BUILD ${CMAKE_CURRENT_BINARY_DIR}/eigen/src/eigen)
|
||||
set(eigen_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/eigen/install)
|
||||
|
||||
|
@ -341,62 +341,6 @@ struct cos : base<T, Eigen::internal::scalar_cos_op<T> > {};
|
||||
struct logical_not : base<bool, Eigen::internal::scalar_boolean_not_op<bool> > {
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
|
||||
#ifndef __CUDACC__
|
||||
// Uses STL std cmath functions.
|
||||
template <typename T>
|
||||
bool isinf(T v) {
|
||||
return std::isinf(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool isnan(T v) {
|
||||
return std::isnan(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool isfinite(T v) {
|
||||
return std::isfinite(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T floor(T v) {
|
||||
return std::floor(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ceil(T v) {
|
||||
return std::ceil(v);
|
||||
}
|
||||
#else
|
||||
// Uses CUDA's functions for float and double.
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool isinf(T v) {
|
||||
return ::isinf(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool isnan(T v) {
|
||||
return ::isnan(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool isfinite(T v) {
|
||||
return ::isfinite(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T floor(T v) {
|
||||
return ::floor(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T ceil(T v) {
|
||||
return ::ceil(v);
|
||||
}
|
||||
#endif
|
||||
} // end namespace impl
|
||||
|
||||
// NOTE: std::isinf, std::isnan, std::isfinite are plain function.
|
||||
// Therefore we need to wrap them in functors to be used with Eigen's
|
||||
@ -406,7 +350,7 @@ template <typename T>
|
||||
struct isinf_func {
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
|
||||
return impl::isinf(x);
|
||||
return Eigen::numext::isinf(x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -417,7 +361,7 @@ template <typename T>
|
||||
struct isnan_func {
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
|
||||
return impl::isnan(x);
|
||||
return Eigen::numext::isnan(x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -428,7 +372,7 @@ template <typename T>
|
||||
struct isfinite_func {
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
|
||||
return impl::isfinite(x);
|
||||
return Eigen::numext::isfinite(x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -439,7 +383,7 @@ template <typename T>
|
||||
struct floor_func {
|
||||
typedef T result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(T x) const {
|
||||
return impl::floor(x);
|
||||
return Eigen::numext::floor(x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -450,7 +394,7 @@ template <typename T>
|
||||
struct ceil_func {
|
||||
typedef T result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(T x) const {
|
||||
return impl::ceil(x);
|
||||
return Eigen::numext::ceil(x);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -13,8 +13,8 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
||||
|
||||
native.new_http_archive(
|
||||
name = "eigen_archive",
|
||||
url = "https://bitbucket.org/eigen/eigen/get/e217e6eb56bf.tar.gz",
|
||||
sha256 = "79e85cfbb9776c63ea32021bffd4ddc33914c984354c0a9c8a649b17b788cf41",
|
||||
url = "https://bitbucket.org/eigen/eigen/get/3f653ace7d28.tar.gz",
|
||||
sha256 = "b49502f423deda55cea33bc503f84409cca92157f3b536d17113b81138f86715",
|
||||
build_file = path_prefix + "eigen.BUILD",
|
||||
)
|
||||
|
||||
|
2
third_party/eigen3/Eigen/Cholesky
vendored
2
third_party/eigen3/Eigen/Cholesky
vendored
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/Eigen/Cholesky"
|
||||
#include "eigen-eigen-3f653ace7d28/Eigen/Cholesky"
|
||||
|
2
third_party/eigen3/Eigen/Core
vendored
2
third_party/eigen3/Eigen/Core
vendored
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/Eigen/Core"
|
||||
#include "eigen-eigen-3f653ace7d28/Eigen/Core"
|
||||
|
2
third_party/eigen3/Eigen/Eigenvalues
vendored
2
third_party/eigen3/Eigen/Eigenvalues
vendored
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/Eigen/Eigenvalues"
|
||||
#include "eigen-eigen-3f653ace7d28/Eigen/Eigenvalues"
|
||||
|
2
third_party/eigen3/Eigen/LU
vendored
2
third_party/eigen3/Eigen/LU
vendored
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/Eigen/LU"
|
||||
#include "eigen-eigen-3f653ace7d28/Eigen/LU"
|
||||
|
2
third_party/eigen3/Eigen/QR
vendored
2
third_party/eigen3/Eigen/QR
vendored
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/Eigen/QR"
|
||||
#include "eigen-eigen-3f653ace7d28/Eigen/QR"
|
||||
|
@ -1 +1 @@
|
||||
#include "eigen-eigen-e217e6eb56bf/unsupported/Eigen/CXX11/Tensor"
|
||||
#include "eigen-eigen-3f653ace7d28/unsupported/Eigen/CXX11/Tensor"
|
||||
|
Loading…
Reference in New Issue
Block a user