diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-02-23 05:51:22 +0000 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-02-23 05:51:22 +0000 |
commit | 1d9256f7db5db6c9f7fa915b4af868625f53502f (patch) | |
tree | 19975915638cf3c0034c595a191cce6ab56f43d8 /unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | |
parent | 8cb9bfab870c1f55ea9c69233a832e92c8de189d (diff) |
Updated the padding code to work with half floats
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h index 39a305a93..c3f25f0df 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h @@ -151,27 +151,27 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device for (int i = NumDims - 1; i > 0; --i) { const Index idx = index / m_outputStrides[i]; if (idx < m_padding[i].first || idx >= m_dimensions[i] - m_padding[i].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (idx - m_padding[i].first) * m_inputStrides[i]; index -= idx * m_outputStrides[i]; } if (index < m_padding[0].first || index >= m_dimensions[0] - m_padding[0].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (index - m_padding[0].first); } else { for (int i = 0; i < NumDims - 1; ++i) { const Index idx = index / m_outputStrides[i+1]; if (idx < m_padding[i].first || idx >= m_dimensions[i] - m_padding[i].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (idx - m_padding[i].first) * m_inputStrides[i]; index -= idx * m_outputStrides[i+1]; } if (index < m_padding[NumDims-1].first || index >= m_dimensions[NumDims-1] - m_padding[NumDims-1].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (index - m_padding[NumDims-1].first); } @@ -194,14 +194,14 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device { const Index idx = coords[0]; if (idx < m_padding[0].first || idx >= m_dimensions[0] - m_padding[0].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex = idx - m_padding[0].first; } for (int i = 1; i < NumDims; ++i) { const Index idx = coords[i]; if (idx < m_padding[i].first || idx >= m_dimensions[i] - m_padding[i].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (idx - m_padding[i].first) * m_inputStrides[i]; } @@ -209,14 +209,14 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device { const Index idx = coords[NumDims-1]; if (idx < m_padding[NumDims-1].first || idx >= m_dimensions[NumDims-1] - m_padding[NumDims-1].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex = idx - m_padding[NumDims-1].first; } for (int i = NumDims - 2; i >= 0; --i) { const Index idx = coords[i]; if (idx < m_padding[i].first || idx >= m_dimensions[i] - m_padding[i].second) { - return Scalar(0); + return internal::scalar_cast_op<int, Scalar>()(0); } inputIndex += (idx - m_padding[i].first) * m_inputStrides[i]; } @@ -245,11 +245,11 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= firstPaddedRight && last < lastPaddedRight) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= lastPaddedLeft && last < firstPaddedRight) { // all the coefficient are between the 2 padding zones. @@ -271,11 +271,11 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= firstPaddedRight && last < lastPaddedRight) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= lastPaddedLeft && last < firstPaddedRight) { // all the coefficient are between the 2 padding zones. @@ -304,11 +304,11 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= firstPaddedRight && last < lastPaddedRight) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= lastPaddedLeft && last < firstPaddedRight) { // all the coefficient are between the 2 padding zones. @@ -330,11 +330,11 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= firstPaddedRight && last < lastPaddedRight) { // all the coefficient are in the padding zone. - return internal::pset1<PacketReturnType>(Scalar(0)); + return internal::pset1<PacketReturnType>(internal::scalar_cast_op<int, Scalar>()(0)); } else if (first >= lastPaddedLeft && last < firstPaddedRight) { // all the coefficient are between the 2 padding zones. |