From f74ab8cb8de5e425ddd25f4b06657926a2ad4599 Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Mon, 7 Oct 2019 15:34:26 -0700 Subject: Add block evaluation to TensorEvalTo and fix few small bugs --- unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h index 489b915ac..f3907be6e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h @@ -231,7 +231,11 @@ struct TensorEvaluator, Device EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockV2 blockV2(TensorBlockDesc& desc, TensorBlockScratch& scratch) const { - eigen_assert(m_impl.data() != NULL); + // If one of the dimensions is zero, return empty block view. + if (desc.size() == 0) { + return TensorBlockV2(internal::TensorBlockKind::kView, NULL, + desc.dimensions()); + } // Check if we can reuse `desc` destination, or allocate new scratch buffer. ScalarNoConst* materialized_output = @@ -385,6 +389,8 @@ struct TensorEvaluator, Device const Index out = output_offset + output_inner_pad_before_size; const Index in = input_offset + output_inner_pad_before_size; + eigen_assert(output_inner_copy_size == 0 || m_impl.data() != NULL); + LinCopy::template Run( typename LinCopy::Dst(out, 1, materialized_output), typename LinCopy::Src(in, 1, m_impl.data()), -- cgit v1.2.3