diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-02-21 11:16:15 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-02-21 11:16:15 -0800 |
commit | 96a24b05cc836072ce0fd2b50c4e94ea652bd1aa (patch) | |
tree | 773b0ed90b7723e56844e82c8eecd212372377da /unsupported/Eigen/CXX11/src | |
parent | 203490017f53505176be8d88206a04a2f4ce7be8 (diff) |
Optimized casting of tensors in the case where the casting happens to be a no-op
Diffstat (limited to 'unsupported/Eigen/CXX11/src')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h b/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h index e254c0b7b..21bb91d69 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h @@ -195,8 +195,11 @@ struct TensorEvaluator<const TensorConversionOp<TargetType, ArgType>, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_impl.dimensions(); } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar* /*data*/) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar* data) { + if (internal::is_same<TargetType, SrcType>::value) { + return m_impl.evalSubExprsIfNeeded((SrcType*)data); + } m_impl.evalSubExprsIfNeeded(NULL); return true; } |