Upgraded eigen to the latest version

Change: 129887348
This commit is contained in:
Benoit Steiner 2016-08-10 10:11:41 -08:00 committed by Gunhan Gulsoy
parent d027643a74
commit 3c5774d5d1
4 changed files with 15 additions and 56 deletions

View File

@ -386,61 +386,20 @@ struct logical_not : base<bool, Eigen::internal::scalar_boolean_not_op<bool> > {
// NOTE: std::isinf, std::isnan, std::isfinite are plain function.
// Therefore we need to wrap them in functors to be used with Eigen's
// type system.
template <typename T>
struct isinf : base<T, Eigen::internal::scalar_isinf_op<T>, bool> {};
template <typename T>
struct isinf_func {
typedef bool result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
return Eigen::numext::isinf(x);
}
};
struct isnan : base<T, Eigen::internal::scalar_isnan_op<T>, bool> {};
template <typename T>
struct isinf : base<T, isinf_func<T>, bool> {};
struct isfinite : base<T, Eigen::internal::scalar_isfinite_op<T>, bool> {};
template <typename T>
struct isnan_func {
typedef bool result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
return Eigen::numext::isnan(x);
}
};
struct floor : base<T, Eigen::internal::scalar_floor_op<T>> {};
template <typename T>
struct isnan : base<T, isnan_func<T>, bool> {};
template <typename T>
struct isfinite_func {
typedef bool result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(T x) const {
return Eigen::numext::isfinite(x);
}
};
template <typename T>
struct isfinite : base<T, isfinite_func<T>, bool> {};
template <typename T>
struct floor_func {
typedef T result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(T x) const {
return Eigen::numext::floor(x);
}
};
template <typename T>
struct floor : base<T, floor_func<T> > {};
template <typename T>
struct ceil_func {
typedef T result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(T x) const {
return Eigen::numext::ceil(x);
}
};
template <typename T>
struct ceil : base<T, ceil_func<T> > {};
struct ceil : base<T, Eigen::internal::scalar_ceil_op<T>> {};
////////////////////////////////////////////////////////////////////////////////
// Binary functors

View File

@ -110,7 +110,7 @@ struct CopyThatWorksWithStringPointer<Eigen::half> {
d(d_start[0] + i0, d_start[1] + i1, d_start[2] + i2,
d_start[3] + i3, d_start[4] + i4, d_start[5] + i5,
d_start[6] + i6, d_start[7] + i7) =
Eigen::internal::raw_uint16_to_half(
Eigen::half_impl::raw_uint16_to_half(
s(s_start[0] + i0, s_start[1] + i1, s_start[2] + i2,
s_start[3] + i3, s_start[4] + i4, s_start[5] + i5,
s_start[6] + i6, s_start[7] + i7));

View File

@ -55,13 +55,13 @@ def SortEigenDecomposition(e, v):
def _GetSelfAdjointEigTest(dtype_, shape_):
def CompareEigenVectors(self, x, y, atol):
def CompareEigenVectors(self, x, y, tol):
# Eigenvectors are only unique up to sign so we normalize the signs first.
signs = np.sign(np.sum(np.divide(x, y), -2, keepdims=True))
x *= signs
self.assertAllClose(x, y, atol)
self.assertAllClose(x, y, atol=tol, rtol=tol)
def CompareEigenDecompositions(self, x_e, x_v, y_e, y_v, atol):
def CompareEigenDecompositions(self, x_e, x_v, y_e, y_v, tol):
num_batches = int(np.prod(x_e.shape[:-1]))
n = x_e.shape[-1]
x_e = np.reshape(x_e, [num_batches] + [n])
@ -71,8 +71,8 @@ def _GetSelfAdjointEigTest(dtype_, shape_):
for i in range(num_batches):
x_ei, x_vi = SortEigenDecomposition(x_e[i, :], x_v[i, :, :])
y_ei, y_vi = SortEigenDecomposition(y_e[i, :], y_v[i, :, :])
self.assertAllClose(x_ei, y_ei, atol=atol)
CompareEigenVectors(self, x_vi, y_vi, atol)
self.assertAllClose(x_ei, y_ei, atol=tol, rtol=tol)
CompareEigenVectors(self, x_vi, y_vi, tol)
def Test(self):
np.random.seed(1)
@ -85,7 +85,7 @@ def _GetSelfAdjointEigTest(dtype_, shape_):
if dtype_ == np.float32:
atol = 1e-4
else:
atol = 1e-14
atol = 1e-12
for compute_v in False, True:
np_e, np_v = np.linalg.eig(a)
with self.test_session():

View File

@ -7,8 +7,8 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
# These lines need to be changed when updating Eigen. They are parsed from
# this file by the cmake and make builds to determine the eigen version and hash.
eigen_version = "b4fa9622b809"
eigen_sha256 = "2862840c2de9c0473a4ef20f8678949ae89ab25965352ee53329e63ba46cec62"
eigen_version = "6f952374ef2b"
eigen_sha256 = "56d658324b09de3f418ae42ca0646dd1e6e0b897dd58b164ec0d21315764afd9"
native.new_http_archive(
name = "eigen_archive",