mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Deleted the coordinate based evaluation of tensor expressions, since it's hardly ever used and started to cause some issues with some versions of xcode.
This commit is contained in:
@@ -167,7 +167,7 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
|
||||
IsAligned = false,
|
||||
PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
|
||||
Layout = TensorEvaluator<ArgType, Device>::Layout,
|
||||
CoordAccess = NumDims == 5,
|
||||
CoordAccess = false,
|
||||
RawAccess = false
|
||||
};
|
||||
|
||||
@@ -437,59 +437,6 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
|
||||
Index rowInflateStride() const { return m_row_inflate_strides; }
|
||||
Index colInflateStride() const { return m_col_inflate_strides; }
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array<Index, NumDims>& coords) const
|
||||
{
|
||||
// Location of the first element of the patch.
|
||||
// ColMajor
|
||||
// 0: d, 1: patch_rows, 2: patch_cols, 3: number of patches, 4: number of batches
|
||||
// RowMajor
|
||||
// 0: number of batches, 1: number of patches, 2: patch_cols , 3: patch_rows, 4: d
|
||||
const Index patch2DIndex = coords[static_cast<int>(Layout) == static_cast<int>(ColMajor) ? 3 : 1];
|
||||
|
||||
array<Index, NumDims-1> inputCoords;
|
||||
Index input_col_idx = patch2DIndex / m_fastInputColsEff;
|
||||
Index inputCol = input_col_idx + coords[1] * m_in_row_strides - m_rowPaddingTop;
|
||||
Index inputRow = patch2DIndex - input_col_idx * m_input_cols_eff + coords[2] * m_in_col_strides - m_colPaddingLeft;
|
||||
const Index origInputCol = (m_col_inflate_strides == 1) ? inputCol : ((inputCol >= 0) ? (inputCol / m_fastInputColStride) : 0);
|
||||
const Index origInputRow = (m_row_inflate_strides == 1) ? inputRow : ((inputRow >= 0) ? (inputRow / m_fastInputRowStride) : 0);
|
||||
if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
|
||||
inputCoords[0] = coords[0]; // depth
|
||||
inputCoords[1] = origInputCol;
|
||||
inputCoords[2] = origInputRow;
|
||||
inputCoords[3] = coords[4]; // batch
|
||||
} else {
|
||||
inputCoords[3] = coords[4]; // depth
|
||||
inputCoords[2] = origInputCol;
|
||||
inputCoords[1] = origInputRow;
|
||||
inputCoords[0] = coords[0]; // batch
|
||||
}
|
||||
// If the computed coordinates are outside the original image perimeter, return 0.
|
||||
if (inputCol < 0 || inputCol >= m_input_cols_eff || inputRow < 0 || inputRow >= m_input_rows_eff ||
|
||||
((m_col_inflate_strides != 1) && (inputCol != origInputCol * m_col_inflate_strides)) ||
|
||||
((m_row_inflate_strides != 1) && (inputRow != origInputRow * m_row_inflate_strides))) {
|
||||
return Scalar(m_paddingValue);
|
||||
}
|
||||
if (TensorEvaluator<ArgType, Device>::CoordAccess) {
|
||||
return m_impl.coeff(inputCoords);
|
||||
} else {
|
||||
Index inputIndex;
|
||||
if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
|
||||
inputIndex =
|
||||
inputCoords[3] * m_patchInputStride +
|
||||
inputCoords[2] * m_colInputStride +
|
||||
inputCoords[1] * m_rowInputStride +
|
||||
inputCoords[0];
|
||||
} else {
|
||||
inputIndex =
|
||||
inputCoords[1] * m_patchInputStride +
|
||||
inputCoords[2] * m_colInputStride +
|
||||
inputCoords[3] * m_rowInputStride +
|
||||
inputCoords[4];
|
||||
}
|
||||
return m_impl.coeff(inputIndex);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user