Skip to content

Commit ad69492

Browse files
committed
fix StridedTensorMap operator() for single index
1 parent 2c7c276 commit ad69492

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

nCompiler/inst/include/nCompiler/ET_ext/StridedTensorMap.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ namespace Eigen {
180180
EIGEN_STRONG_INLINE Index dimension(Index n) const { return m_dimensions[n]; }
181181
EIGEN_DEVICE_FUNC
182182
EIGEN_STRONG_INLINE Index stride(Index n) const { return m_strides[n]; } // Added for StridedTensorMap
183-
EIGEN_DEVICE_FUNC
184-
EIGEN_STRONG_INLINE Index offset() const { return m_offset; } // Added for StridedTensorMap
185183

186184
EIGEN_DEVICE_FUNC
187185
EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
@@ -223,7 +221,7 @@ namespace Eigen {
223221
EIGEN_STRONG_INLINE const Scalar& operator()(Index index) const
224222
{
225223
eigen_internal_assert(index >= 0 && index < size());
226-
return m_data[m_offset + m_strides[0] * index]; // Modified for StridedTensorMap.
224+
return m_data[m_startIndices[0] + m_strides[0] * index]; // Modified for StridedTensorMap.
227225
}
228226

229227
#if USE_VARIADIC_TEMPLATES_IN_STRIDED_TENSOR_MAP //EIGEN_HAS_VARIADIC_TEMPLATES
@@ -251,7 +249,6 @@ namespace Eigen {
251249
return m_data[index];
252250
} else {
253251
const Index index = m_startIndices[0] + i0*m_strides[0] + m_dimensions[0]*( (i1*m_strides[1] + m_startIndices[1])); // Modified for StridedTensorMap
254-
m_offset + m_strides[0] * (i0 + i1 * m_strides[1]); // Modified for StridedTensorMap
255252
return m_data[index];
256253
}
257254
}
@@ -331,7 +328,7 @@ namespace Eigen {
331328
EIGEN_STRONG_INLINE Scalar& operator()(Index index)
332329
{
333330
eigen_internal_assert(index >= 0 && index < size());
334-
return m_data[m_offset + m_strides[0] * index]; // Modified for StridedTensorMap.
331+
return m_data[m_startIndices[0] + m_strides[0] * index]; // Modified for StridedTensorMap.
335332
}
336333

337334
#if USE_VARIADIC_TEMPLATES_IN_STRIDED_TENSOR_MAP //EIGEN_HAS_VARIADIC_TEMPLATES
@@ -360,7 +357,6 @@ namespace Eigen {
360357
return m_data[index];
361358
} else {
362359
const Index index = m_startIndices[0] + i0*m_strides[0] + m_dimensions[0]*( (i1*m_strides[1] + m_startIndices[1])); // Modified for StridedTensorMap
363-
m_offset + m_strides[0] * (i0 + i1 * m_strides[1]); // Modified for StridedTensorMap
364360
return m_data[index];
365361
}
366362
}
@@ -436,7 +432,6 @@ namespace Eigen {
436432
Dimensions m_strides; // Added for StridedTensorMap. Could this be a simple array?
437433
Dimensions m_startIndices; // ditto
438434
Dimensions m_stopIndices; // ditto
439-
Index m_offset;
440435
};
441436

442437
// TensorEvaluator cases are modified from TensorSlidingSlicingOp

0 commit comments

Comments
 (0)