aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-04-20 18:08:20 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-04-20 18:08:20 -0700
commit2dde1b102866e1928e925678951463f2a7051af1 (patch)
treed6405558903617aa9f5fabe4be8b5601fe6d406a /unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
parenta792cd357d31f0a4fce62ed1fa4cc0334cf2f143 (diff)
Don't crash when attempting to reduce empty tensors.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
index 6af2d45d4..cd04716bd 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
@@ -24,9 +24,17 @@ const T2& choose(Cond<false>, const T1&, const T2& second) {
return second;
}
-template <typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
+
+template <typename T, typename X, typename Y>
+EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
+T divup(const X x, const Y y) {
+ return static_cast<T>((x + y - 1) / y);
+}
+
+template <typename T>
+EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
T divup(const T x, const T y) {
- return (x + y - 1) / y;
+ return static_cast<T>((x + y - 1) / y);
}
template <size_t n> struct max_n_1 {