aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-21 11:16:15 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-21 11:16:15 -0800
commit96a24b05cc836072ce0fd2b50c4e94ea652bd1aa (patch)
tree773b0ed90b7723e56844e82c8eecd212372377da /unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h
parent203490017f53505176be8d88206a04a2f4ce7be8 (diff)
Optimized casting of tensors in the case where the casting happens to be a no-op
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h5
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;
}