diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2019-10-07 15:34:26 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2019-10-07 15:34:26 -0700 |
commit | f74ab8cb8de5e425ddd25f4b06657926a2ad4599 (patch) | |
tree | 21686c69f54cd402fdf6508cedcfd25750f70898 /unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | |
parent | 3afb640b5647654f272b1903b71877cb60ed3a78 (diff) |
Add block evaluation to TensorEvalTo and fix few small bugs
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | 8 |
1 files changed, 7 insertions, 1 deletions
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<const TensorPaddingOp<PaddingDimensions, ArgType>, 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<const TensorPaddingOp<PaddingDimensions, ArgType>, 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<LinCopy::Kind::Linear>( typename LinCopy::Dst(out, 1, materialized_output), typename LinCopy::Src(in, 1, m_impl.data()), |