10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
13 #include "./InternalHeaderCheck.h"
33 template<DenseIndex Rows, DenseIndex Cols,
typename XprType>
34 struct traits<TensorImagePatchOp<Rows, Cols, XprType> > :
public traits<XprType>
36 typedef std::remove_const_t<typename XprType::Scalar> Scalar;
37 typedef traits<XprType> XprTraits;
38 typedef typename XprTraits::StorageKind StorageKind;
39 typedef typename XprTraits::Index
Index;
40 typedef typename XprType::Nested Nested;
41 typedef std::remove_reference_t<Nested> Nested_;
42 static constexpr
int NumDimensions = XprTraits::NumDimensions + 1;
43 static constexpr
int Layout = XprTraits::Layout;
44 typedef typename XprTraits::PointerType PointerType;
47 template<DenseIndex Rows, DenseIndex Cols,
typename XprType>
48 struct eval<TensorImagePatchOp<Rows, Cols, XprType>,
Eigen::Dense>
50 typedef const TensorImagePatchOp<Rows, Cols, XprType>& type;
53 template<DenseIndex Rows, DenseIndex Cols,
typename XprType>
54 struct nested<TensorImagePatchOp<Rows, Cols, XprType>, 1, typename eval<TensorImagePatchOp<Rows, Cols, XprType> >::type>
56 typedef TensorImagePatchOp<Rows, Cols, XprType> type;
59 template <
typename Self,
bool Vectorizable>
60 struct ImagePatchCopyOp {
61 typedef typename Self::Index
Index;
62 typedef typename Self::Scalar Scalar;
63 typedef typename Self::Impl Impl;
64 static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void Run(
65 const Self&
self,
const Index num_coeff_to_copy,
const Index dst_index,
66 Scalar* dst_data,
const Index src_index) {
67 const Impl& impl =
self.impl();
68 for (
Index i = 0; i < num_coeff_to_copy; ++i) {
69 dst_data[dst_index + i] = impl.coeff(src_index + i);
74 template <
typename Self>
75 struct ImagePatchCopyOp<Self, true> {
76 typedef typename Self::Index
Index;
77 typedef typename Self::Scalar Scalar;
78 typedef typename Self::Impl Impl;
79 typedef typename packet_traits<Scalar>::type Packet;
80 static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void Run(
81 const Self&
self,
const Index num_coeff_to_copy,
const Index dst_index,
82 Scalar* dst_data,
const Index src_index) {
83 const Impl& impl =
self.impl();
84 const Index packet_size = internal::unpacket_traits<Packet>::size;
85 const Index vectorized_size =
86 (num_coeff_to_copy / packet_size) * packet_size;
87 for (
Index i = 0; i < vectorized_size; i += packet_size) {
88 Packet p = impl.template packet<Unaligned>(src_index + i);
89 internal::pstoret<Scalar, Packet, Unaligned>(dst_data + dst_index + i, p);
91 for (
Index i = vectorized_size; i < num_coeff_to_copy; ++i) {
92 dst_data[dst_index + i] = impl.coeff(src_index + i);
97 template <
typename Self>
98 struct ImagePatchPaddingOp {
99 typedef typename Self::Index
Index;
100 typedef typename Self::Scalar Scalar;
101 typedef typename packet_traits<Scalar>::type Packet;
102 static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void Run(
103 const Index num_coeff_to_pad,
const Scalar padding_value,
104 const Index dst_index, Scalar* dst_data) {
105 const Index packet_size = internal::unpacket_traits<Packet>::size;
106 const Packet padded_packet = internal::pset1<Packet>(padding_value);
107 const Index vectorized_size =
108 (num_coeff_to_pad / packet_size) * packet_size;
109 for (
Index i = 0; i < vectorized_size; i += packet_size) {
110 internal::pstoret<Scalar, Packet, Unaligned>(dst_data + dst_index + i,
113 for (
Index i = vectorized_size; i < num_coeff_to_pad; ++i) {
114 dst_data[dst_index + i] = padding_value;
121 template<DenseIndex Rows, DenseIndex Cols,
typename XprType>
122 class TensorImagePatchOp :
public TensorBase<TensorImagePatchOp<Rows, Cols, XprType>, ReadOnlyAccessors>
125 typedef typename Eigen::internal::traits<TensorImagePatchOp>::Scalar Scalar;
127 typedef typename XprType::CoeffReturnType CoeffReturnType;
128 typedef typename Eigen::internal::nested<TensorImagePatchOp>::type Nested;
129 typedef typename Eigen::internal::traits<TensorImagePatchOp>::StorageKind StorageKind;
130 typedef typename Eigen::internal::traits<TensorImagePatchOp>::Index
Index;
132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorImagePatchOp(
const XprType& expr, DenseIndex patch_rows, DenseIndex patch_cols,
133 DenseIndex row_strides, DenseIndex col_strides,
134 DenseIndex in_row_strides, DenseIndex in_col_strides,
135 DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
136 PaddingType padding_type, Scalar padding_value)
137 : m_xpr(expr), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
138 m_row_strides(row_strides), m_col_strides(col_strides),
139 m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
140 m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
141 m_padding_explicit(false), m_padding_top(0), m_padding_bottom(0), m_padding_left(0), m_padding_right(0),
142 m_padding_type(padding_type), m_padding_value(padding_value) {}
144 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorImagePatchOp(
const XprType& expr, DenseIndex patch_rows, DenseIndex patch_cols,
145 DenseIndex row_strides, DenseIndex col_strides,
146 DenseIndex in_row_strides, DenseIndex in_col_strides,
147 DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
148 DenseIndex padding_top, DenseIndex padding_bottom,
149 DenseIndex padding_left, DenseIndex padding_right,
150 Scalar padding_value)
151 : m_xpr(expr), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
152 m_row_strides(row_strides), m_col_strides(col_strides),
153 m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
154 m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
155 m_padding_explicit(true), m_padding_top(padding_top), m_padding_bottom(padding_bottom),
156 m_padding_left(padding_left), m_padding_right(padding_right),
157 m_padding_type(PADDING_VALID), m_padding_value(padding_value) {}
161 DenseIndex patch_rows()
const {
return m_patch_rows; }
163 DenseIndex patch_cols()
const {
return m_patch_cols; }
165 DenseIndex row_strides()
const {
return m_row_strides; }
167 DenseIndex col_strides()
const {
return m_col_strides; }
169 DenseIndex in_row_strides()
const {
return m_in_row_strides; }
171 DenseIndex in_col_strides()
const {
return m_in_col_strides; }
173 DenseIndex row_inflate_strides()
const {
return m_row_inflate_strides; }
175 DenseIndex col_inflate_strides()
const {
return m_col_inflate_strides; }
177 bool padding_explicit()
const {
return m_padding_explicit; }
179 DenseIndex padding_top()
const {
return m_padding_top; }
181 DenseIndex padding_bottom()
const {
return m_padding_bottom; }
183 DenseIndex padding_left()
const {
return m_padding_left; }
185 DenseIndex padding_right()
const {
return m_padding_right; }
187 PaddingType padding_type()
const {
return m_padding_type; }
189 Scalar padding_value()
const {
return m_padding_value; }
192 const internal::remove_all_t<typename XprType::Nested>&
193 expression()
const {
return m_xpr; }
196 typename XprType::Nested m_xpr;
197 const DenseIndex m_patch_rows;
198 const DenseIndex m_patch_cols;
199 const DenseIndex m_row_strides;
200 const DenseIndex m_col_strides;
201 const DenseIndex m_in_row_strides;
202 const DenseIndex m_in_col_strides;
203 const DenseIndex m_row_inflate_strides;
204 const DenseIndex m_col_inflate_strides;
205 const bool m_padding_explicit;
206 const DenseIndex m_padding_top;
207 const DenseIndex m_padding_bottom;
208 const DenseIndex m_padding_left;
209 const DenseIndex m_padding_right;
210 const PaddingType m_padding_type;
211 const Scalar m_padding_value;
215 template<DenseIndex Rows, DenseIndex Cols,
typename ArgType,
typename Device>
216 struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
218 typedef TensorImagePatchOp<Rows, Cols, ArgType> XprType;
219 typedef typename XprType::Index
Index;
220 static constexpr
int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
221 static constexpr
int NumDims = NumInputDims + 1;
222 typedef DSizes<Index, NumDims> Dimensions;
223 typedef std::remove_const_t<typename XprType::Scalar> Scalar;
224 typedef TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>,
226 typedef TensorEvaluator<ArgType, Device> Impl;
227 typedef typename XprType::CoeffReturnType CoeffReturnType;
228 typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
229 static constexpr
int PacketSize = PacketType<CoeffReturnType, Device>::size;
230 typedef StorageMemory<CoeffReturnType, Device> Storage;
231 typedef typename Storage::Type EvaluatorPointerType;
233 static constexpr
int Layout = TensorEvaluator<ArgType, Device>::Layout;
236 PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
238 PreferBlockAccess =
true,
244 typedef internal::TensorBlockNotImplemented TensorBlock;
247 EIGEN_STRONG_INLINE TensorEvaluator(
const XprType& op,
const Device& device)
248 : m_device(device), m_impl(op.expression(), device)
250 EIGEN_STATIC_ASSERT((NumDims >= 4), YOU_MADE_A_PROGRAMMING_MISTAKE);
252 m_paddingValue = op.padding_value();
254 const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
257 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
258 m_inputDepth = input_dims[0];
259 m_inputRows = input_dims[1];
260 m_inputCols = input_dims[2];
262 m_inputDepth = input_dims[NumInputDims-1];
263 m_inputRows = input_dims[NumInputDims-2];
264 m_inputCols = input_dims[NumInputDims-3];
267 m_row_strides = op.row_strides();
268 m_col_strides = op.col_strides();
271 m_in_row_strides = op.in_row_strides();
272 m_in_col_strides = op.in_col_strides();
273 m_row_inflate_strides = op.row_inflate_strides();
274 m_col_inflate_strides = op.col_inflate_strides();
288 m_input_rows_eff = (m_inputRows - 1) * m_row_inflate_strides + 1;
289 m_input_cols_eff = (m_inputCols - 1) * m_col_inflate_strides + 1;
290 m_patch_rows_eff = op.patch_rows() + (op.patch_rows() - 1) * (m_in_row_strides - 1);
291 m_patch_cols_eff = op.patch_cols() + (op.patch_cols() - 1) * (m_in_col_strides - 1);
293 if (op.padding_explicit()) {
294 m_outputRows = numext::ceil((m_input_rows_eff + op.padding_top() + op.padding_bottom() - m_patch_rows_eff + 1.f) /
static_cast<float>(m_row_strides));
295 m_outputCols = numext::ceil((m_input_cols_eff + op.padding_left() + op.padding_right() - m_patch_cols_eff + 1.f) /
static_cast<float>(m_col_strides));
296 m_rowPaddingTop = op.padding_top();
297 m_colPaddingLeft = op.padding_left();
300 switch (op.padding_type()) {
302 m_outputRows = numext::ceil((m_input_rows_eff - m_patch_rows_eff + 1.f) /
static_cast<float>(m_row_strides));
303 m_outputCols = numext::ceil((m_input_cols_eff - m_patch_cols_eff + 1.f) /
static_cast<float>(m_col_strides));
305 m_rowPaddingTop = numext::maxi<Index>(0, ((m_outputRows - 1) * m_row_strides + m_patch_rows_eff - m_input_rows_eff) / 2);
306 m_colPaddingLeft = numext::maxi<Index>(0, ((m_outputCols - 1) * m_col_strides + m_patch_cols_eff - m_input_cols_eff) / 2);
309 m_outputRows = numext::ceil(m_input_rows_eff /
static_cast<float>(m_row_strides));
310 m_outputCols = numext::ceil(m_input_cols_eff /
static_cast<float>(m_col_strides));
312 m_rowPaddingTop = ((m_outputRows - 1) * m_row_strides + m_patch_rows_eff - m_input_rows_eff) / 2;
313 m_colPaddingLeft = ((m_outputCols - 1) * m_col_strides + m_patch_cols_eff - m_input_cols_eff) / 2;
316 m_rowPaddingTop = numext::maxi<Index>(0, m_rowPaddingTop);
317 m_colPaddingLeft = numext::maxi<Index>(0, m_colPaddingLeft);
320 eigen_assert(
false &&
"unexpected padding");
325 eigen_assert(m_outputRows > 0);
326 eigen_assert(m_outputCols > 0);
329 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
336 m_dimensions[0] = input_dims[0];
337 m_dimensions[1] = op.patch_rows();
338 m_dimensions[2] = op.patch_cols();
339 m_dimensions[3] = m_outputRows * m_outputCols;
340 for (
int i = 4; i < NumDims; ++i) {
341 m_dimensions[i] = input_dims[i-1];
350 m_dimensions[NumDims-1] = input_dims[NumInputDims-1];
351 m_dimensions[NumDims-2] = op.patch_rows();
352 m_dimensions[NumDims-3] = op.patch_cols();
353 m_dimensions[NumDims-4] = m_outputRows * m_outputCols;
354 for (
int i = NumDims-5; i >= 0; --i) {
355 m_dimensions[i] = input_dims[i];
360 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
361 m_colStride = m_dimensions[1];
362 m_patchStride = m_colStride * m_dimensions[2] * m_dimensions[0];
363 m_otherStride = m_patchStride * m_dimensions[3];
365 m_colStride = m_dimensions[NumDims-2];
366 m_patchStride = m_colStride * m_dimensions[NumDims-3] * m_dimensions[NumDims-1];
367 m_otherStride = m_patchStride * m_dimensions[NumDims-4];
371 m_rowInputStride = m_inputDepth;
372 m_colInputStride = m_inputDepth * m_inputRows;
373 m_patchInputStride = m_inputDepth * m_inputRows * m_inputCols;
376 m_fastOtherStride = internal::TensorIntDivisor<Index>(m_otherStride);
377 m_fastPatchStride = internal::TensorIntDivisor<Index>(m_patchStride);
378 m_fastColStride = internal::TensorIntDivisor<Index>(m_colStride);
379 m_fastInflateRowStride = internal::TensorIntDivisor<Index>(m_row_inflate_strides);
380 m_fastInflateColStride = internal::TensorIntDivisor<Index>(m_col_inflate_strides);
381 m_fastInputColsEff = internal::TensorIntDivisor<Index>(m_input_cols_eff);
384 m_fastOutputRows = internal::TensorIntDivisor<Index>(m_outputRows);
385 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
386 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[0]);
388 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[NumDims-1]);
392 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Dimensions& dimensions()
const {
return m_dimensions; }
394 EIGEN_STRONG_INLINE
bool evalSubExprsIfNeeded(EvaluatorPointerType ) {
395 m_impl.evalSubExprsIfNeeded(NULL);
399 #ifdef EIGEN_USE_THREADS
400 template <
typename EvalSubExprsCallback>
401 EIGEN_STRONG_INLINE
void evalSubExprsIfNeededAsync(
402 EvaluatorPointerType, EvalSubExprsCallback done) {
403 m_impl.evalSubExprsIfNeededAsync(
nullptr, [done](
bool) { done(
true); });
407 EIGEN_STRONG_INLINE
void cleanup() {
411 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index)
const
414 const Index patchIndex = index / m_fastPatchStride;
416 const Index patchOffset = (index - patchIndex * m_patchStride) / m_fastOutputDepth;
419 const Index otherIndex = (NumDims == 4) ? 0 : index / m_fastOtherStride;
420 const Index patch2DIndex = (NumDims == 4) ? patchIndex : (index - otherIndex * m_otherStride) / m_fastPatchStride;
423 const Index colIndex = patch2DIndex / m_fastOutputRows;
424 const Index colOffset = patchOffset / m_fastColStride;
425 const Index inputCol = colIndex * m_col_strides + colOffset * m_in_col_strides - m_colPaddingLeft;
426 const Index origInputCol = (m_col_inflate_strides == 1) ? inputCol : ((inputCol >= 0) ? (inputCol / m_fastInflateColStride) : 0);
427 if (inputCol < 0 || inputCol >= m_input_cols_eff ||
428 ((m_col_inflate_strides != 1) && (inputCol != origInputCol * m_col_inflate_strides))) {
429 return Scalar(m_paddingValue);
433 const Index rowIndex = patch2DIndex - colIndex * m_outputRows;
434 const Index rowOffset = patchOffset - colOffset * m_colStride;
435 const Index inputRow = rowIndex * m_row_strides + rowOffset * m_in_row_strides - m_rowPaddingTop;
436 const Index origInputRow = (m_row_inflate_strides == 1) ? inputRow : ((inputRow >= 0) ? (inputRow / m_fastInflateRowStride) : 0);
437 if (inputRow < 0 || inputRow >= m_input_rows_eff ||
438 ((m_row_inflate_strides != 1) && (inputRow != origInputRow * m_row_inflate_strides))) {
439 return Scalar(m_paddingValue);
442 const int depth_index =
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor) ? 0 : NumDims - 1;
443 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
445 const Index inputIndex = depth + origInputRow * m_rowInputStride + origInputCol * m_colInputStride + otherIndex * m_patchInputStride;
446 return m_impl.coeff(inputIndex);
449 template<
int LoadMode>
450 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index)
const
452 eigen_assert(index+PacketSize-1 < dimensions().TotalSize());
454 if (m_in_row_strides != 1 || m_in_col_strides != 1 || m_row_inflate_strides != 1 || m_col_inflate_strides != 1) {
455 return packetWithPossibleZero(index);
458 const Index indices[2] = {index, index + PacketSize - 1};
459 const Index patchIndex = indices[0] / m_fastPatchStride;
460 if (patchIndex != indices[1] / m_fastPatchStride) {
461 return packetWithPossibleZero(index);
463 const Index otherIndex = (NumDims == 4) ? 0 : indices[0] / m_fastOtherStride;
464 eigen_assert(otherIndex == indices[1] / m_fastOtherStride);
467 const Index patchOffsets[2] = {(indices[0] - patchIndex * m_patchStride) / m_fastOutputDepth,
468 (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth};
470 const Index patch2DIndex = (NumDims == 4) ? patchIndex : (indices[0] - otherIndex * m_otherStride) / m_fastPatchStride;
471 eigen_assert(patch2DIndex == (indices[1] - otherIndex * m_otherStride) / m_fastPatchStride);
473 const Index colIndex = patch2DIndex / m_fastOutputRows;
474 const Index colOffsets[2] = {patchOffsets[0] / m_fastColStride, patchOffsets[1] / m_fastColStride};
477 const Index inputCols[2] = {colIndex * m_col_strides + colOffsets[0] -
478 m_colPaddingLeft, colIndex * m_col_strides + colOffsets[1] - m_colPaddingLeft};
479 if (inputCols[1] < 0 || inputCols[0] >= m_inputCols) {
480 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
483 if (inputCols[0] == inputCols[1]) {
484 const Index rowIndex = patch2DIndex - colIndex * m_outputRows;
485 const Index rowOffsets[2] = {patchOffsets[0] - colOffsets[0]*m_colStride, patchOffsets[1] - colOffsets[1]*m_colStride};
486 eigen_assert(rowOffsets[0] <= rowOffsets[1]);
488 const Index inputRows[2] = {rowIndex * m_row_strides + rowOffsets[0] -
489 m_rowPaddingTop, rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop};
491 if (inputRows[1] < 0 || inputRows[0] >= m_inputRows) {
492 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
495 if (inputRows[0] >= 0 && inputRows[1] < m_inputRows) {
497 const int depth_index =
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor) ? 0 : NumDims - 1;
498 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
499 const Index inputIndex = depth + inputRows[0] * m_rowInputStride + inputCols[0] * m_colInputStride + otherIndex * m_patchInputStride;
500 return m_impl.template packet<Unaligned>(inputIndex);
504 return packetWithPossibleZero(index);
507 EIGEN_DEVICE_FUNC EvaluatorPointerType data()
const {
return NULL; }
509 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const TensorEvaluator<ArgType, Device>& impl()
const {
return m_impl; }
511 #ifdef EIGEN_USE_SYCL
513 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void bind(cl::sycl::handler &cgh)
const {
518 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rowPaddingTop()
const {
return m_rowPaddingTop; }
519 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index colPaddingLeft()
const {
return m_colPaddingLeft; }
520 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index outputRows()
const {
return m_outputRows; }
521 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index outputCols()
const {
return m_outputCols; }
522 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index userRowStride()
const {
return m_row_strides; }
523 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index userColStride()
const {
return m_col_strides; }
524 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index userInRowStride()
const {
return m_in_row_strides; }
525 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index userInColStride()
const {
return m_in_col_strides; }
526 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rowInflateStride()
const {
return m_row_inflate_strides; }
527 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index colInflateStride()
const {
return m_col_inflate_strides; }
529 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost
530 costPerCoeff(
bool vectorized)
const {
534 const double compute_cost = 3 * TensorOpCost::DivCost<Index>() +
535 6 * TensorOpCost::MulCost<Index>() +
536 8 * TensorOpCost::MulCost<Index>();
537 return m_impl.costPerCoeff(vectorized) +
538 TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
542 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index)
const
544 EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
546 for (
int i = 0; i < PacketSize; ++i) {
547 values[i] = coeff(index+i);
549 PacketReturnType rslt = internal::pload<PacketReturnType>(values);
553 Dimensions m_dimensions;
561 Index m_in_row_strides;
562 Index m_in_col_strides;
563 Index m_row_inflate_strides;
564 Index m_col_inflate_strides;
566 Index m_input_rows_eff;
567 Index m_input_cols_eff;
568 Index m_patch_rows_eff;
569 Index m_patch_cols_eff;
571 internal::TensorIntDivisor<Index> m_fastOtherStride;
572 internal::TensorIntDivisor<Index> m_fastPatchStride;
573 internal::TensorIntDivisor<Index> m_fastColStride;
574 internal::TensorIntDivisor<Index> m_fastInflateRowStride;
575 internal::TensorIntDivisor<Index> m_fastInflateColStride;
576 internal::TensorIntDivisor<Index> m_fastInputColsEff;
578 Index m_rowInputStride;
579 Index m_colInputStride;
580 Index m_patchInputStride;
589 Index m_rowPaddingTop;
590 Index m_colPaddingLeft;
592 internal::TensorIntDivisor<Index> m_fastOutputRows;
593 internal::TensorIntDivisor<Index> m_fastOutputDepth;
595 Scalar m_paddingValue;
597 const Device EIGEN_DEVICE_REF m_device;
598 TensorEvaluator<ArgType, Device> m_impl;
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index