Loading...
Searching...
No Matches
TensorImagePatch.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
11#define EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
12
13namespace Eigen {
14
15namespace internal {
16template<DenseIndex Rows, DenseIndex Cols, typename XprType>
17struct traits<TensorImagePatchOp<Rows, Cols, XprType> > : public traits<XprType>
18{
19 typedef typename internal::remove_const<typename XprType::Scalar>::type Scalar;
20 typedef traits<XprType> XprTraits;
21 typedef typename XprTraits::StorageKind StorageKind;
22 typedef typename XprTraits::Index Index;
23 typedef typename XprType::Nested Nested;
24 typedef typename remove_reference<Nested>::type _Nested;
25 static const int NumDimensions = XprTraits::NumDimensions + 1;
26 static const int Layout = XprTraits::Layout;
27};
28
29template<DenseIndex Rows, DenseIndex Cols, typename XprType>
30struct eval<TensorImagePatchOp<Rows, Cols, XprType>, Eigen::Dense>
31{
32 typedef const TensorImagePatchOp<Rows, Cols, XprType>& type;
33};
34
35template<DenseIndex Rows, DenseIndex Cols, typename XprType>
36struct nested<TensorImagePatchOp<Rows, Cols, XprType>, 1, typename eval<TensorImagePatchOp<Rows, Cols, XprType> >::type>
37{
38 typedef TensorImagePatchOp<Rows, Cols, XprType> type;
39};
40
41} // end namespace internal
42
57template <DenseIndex Rows, DenseIndex Cols, typename XprType>
58class TensorImagePatchOp : public TensorBase<TensorImagePatchOp<Rows, Cols, XprType>, ReadOnlyAccessors> {
59 public:
60 typedef typename Eigen::internal::traits<TensorImagePatchOp>::Scalar Scalar;
61 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
62 typedef typename XprType::CoeffReturnType CoeffReturnType;
63 typedef typename Eigen::internal::nested<TensorImagePatchOp>::type Nested;
64 typedef typename Eigen::internal::traits<TensorImagePatchOp>::StorageKind StorageKind;
65 typedef typename Eigen::internal::traits<TensorImagePatchOp>::Index Index;
66
67 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorImagePatchOp(const XprType& expr, DenseIndex patch_rows, DenseIndex patch_cols,
68 DenseIndex row_strides, DenseIndex col_strides,
69 DenseIndex in_row_strides, DenseIndex in_col_strides,
70 DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
71 PaddingType padding_type, Scalar padding_value)
72 : m_xpr(expr), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
73 m_row_strides(row_strides), m_col_strides(col_strides),
74 m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
75 m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
76 m_padding_explicit(false), m_padding_top(0), m_padding_bottom(0), m_padding_left(0), m_padding_right(0),
77 m_padding_type(padding_type), m_padding_value(padding_value) {}
78
79 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorImagePatchOp(const XprType& expr, DenseIndex patch_rows, DenseIndex patch_cols,
80 DenseIndex row_strides, DenseIndex col_strides,
81 DenseIndex in_row_strides, DenseIndex in_col_strides,
82 DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
83 DenseIndex padding_top, DenseIndex padding_bottom,
84 DenseIndex padding_left, DenseIndex padding_right,
85 Scalar padding_value)
86 : m_xpr(expr), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
87 m_row_strides(row_strides), m_col_strides(col_strides),
88 m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
89 m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
90 m_padding_explicit(true), m_padding_top(padding_top), m_padding_bottom(padding_bottom),
91 m_padding_left(padding_left), m_padding_right(padding_right),
92 m_padding_type(PADDING_VALID), m_padding_value(padding_value) {}
93
94 EIGEN_DEVICE_FUNC
95 DenseIndex patch_rows() const { return m_patch_rows; }
96 EIGEN_DEVICE_FUNC
97 DenseIndex patch_cols() const { return m_patch_cols; }
98 EIGEN_DEVICE_FUNC
99 DenseIndex row_strides() const { return m_row_strides; }
100 EIGEN_DEVICE_FUNC
101 DenseIndex col_strides() const { return m_col_strides; }
102 EIGEN_DEVICE_FUNC
103 DenseIndex in_row_strides() const { return m_in_row_strides; }
104 EIGEN_DEVICE_FUNC
105 DenseIndex in_col_strides() const { return m_in_col_strides; }
106 EIGEN_DEVICE_FUNC
107 DenseIndex row_inflate_strides() const { return m_row_inflate_strides; }
108 EIGEN_DEVICE_FUNC
109 DenseIndex col_inflate_strides() const { return m_col_inflate_strides; }
110 EIGEN_DEVICE_FUNC
111 bool padding_explicit() const { return m_padding_explicit; }
112 EIGEN_DEVICE_FUNC
113 DenseIndex padding_top() const { return m_padding_top; }
114 EIGEN_DEVICE_FUNC
115 DenseIndex padding_bottom() const { return m_padding_bottom; }
116 EIGEN_DEVICE_FUNC
117 DenseIndex padding_left() const { return m_padding_left; }
118 EIGEN_DEVICE_FUNC
119 DenseIndex padding_right() const { return m_padding_right; }
120 EIGEN_DEVICE_FUNC
121 PaddingType padding_type() const { return m_padding_type; }
122 EIGEN_DEVICE_FUNC
123 Scalar padding_value() const { return m_padding_value; }
124
125 EIGEN_DEVICE_FUNC
126 const typename internal::remove_all<typename XprType::Nested>::type&
127 expression() const { return m_xpr; }
128
129 protected:
130 typename XprType::Nested m_xpr;
131 const DenseIndex m_patch_rows;
132 const DenseIndex m_patch_cols;
133 const DenseIndex m_row_strides;
134 const DenseIndex m_col_strides;
135 const DenseIndex m_in_row_strides;
136 const DenseIndex m_in_col_strides;
137 const DenseIndex m_row_inflate_strides;
138 const DenseIndex m_col_inflate_strides;
139 const bool m_padding_explicit;
140 const DenseIndex m_padding_top;
141 const DenseIndex m_padding_bottom;
142 const DenseIndex m_padding_left;
143 const DenseIndex m_padding_right;
144 const PaddingType m_padding_type;
145 const Scalar m_padding_value;
146};
147
148// Eval as rvalue
149template<DenseIndex Rows, DenseIndex Cols, typename ArgType, typename Device>
150struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
151{
153 typedef typename XprType::Index Index;
154 static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
155 static const int NumDims = NumInputDims + 1;
156 typedef DSizes<Index, NumDims> Dimensions;
157 typedef typename internal::remove_const<typename XprType::Scalar>::type Scalar;
159 Device> Self;
161 typedef typename XprType::CoeffReturnType CoeffReturnType;
162 typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
163 static const int PacketSize = internal::unpacket_traits<PacketReturnType>::size;
164
165 enum {
166 IsAligned = false,
167 PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
168 Layout = TensorEvaluator<ArgType, Device>::Layout,
169 CoordAccess = false,
170 RawAccess = false
171 };
172
173 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
174 : m_impl(op.expression(), device)
175 {
176 EIGEN_STATIC_ASSERT((NumDims >= 4), YOU_MADE_A_PROGRAMMING_MISTAKE);
177
178 m_paddingValue = op.padding_value();
179
180 const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
181
182 // Caches a few variables.
183 if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
184 m_inputDepth = input_dims[0];
185 m_inputRows = input_dims[1];
186 m_inputCols = input_dims[2];
187 } else {
188 m_inputDepth = input_dims[NumInputDims-1];
189 m_inputRows = input_dims[NumInputDims-2];
190 m_inputCols = input_dims[NumInputDims-3];
191 }
192
193 m_row_strides = op.row_strides();
194 m_col_strides = op.col_strides();
195
196 // Input strides and effective input/patch size
197 m_in_row_strides = op.in_row_strides();
198 m_in_col_strides = op.in_col_strides();
199 m_row_inflate_strides = op.row_inflate_strides();
200 m_col_inflate_strides = op.col_inflate_strides();
201 // The "effective" input rows and input cols are the input rows and cols
202 // after inflating them with zeros.
203 // For examples, a 2x3 matrix with row_inflate_strides and
204 // col_inflate_strides of 2 comes from:
205 // A B C
206 // D E F
207 //
208 // to a matrix is 3 x 5:
209 //
210 // A . B . C
211 // . . . . .
212 // D . E . F
213
214 m_input_rows_eff = (m_inputRows - 1) * m_row_inflate_strides + 1;
215 m_input_cols_eff = (m_inputCols - 1) * m_col_inflate_strides + 1;
216 m_patch_rows_eff = op.patch_rows() + (op.patch_rows() - 1) * (m_in_row_strides - 1);
217 m_patch_cols_eff = op.patch_cols() + (op.patch_cols() - 1) * (m_in_col_strides - 1);
218
219 if (op.padding_explicit()) {
220 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));
221 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));
222 m_rowPaddingTop = op.padding_top();
223 m_colPaddingLeft = op.padding_left();
224 } else {
225 // Computing padding from the type
226 switch (op.padding_type()) {
227 case PADDING_VALID:
228 m_outputRows = numext::ceil((m_input_rows_eff - m_patch_rows_eff + 1.f) / static_cast<float>(m_row_strides));
229 m_outputCols = numext::ceil((m_input_cols_eff - m_patch_cols_eff + 1.f) / static_cast<float>(m_col_strides));
230 // Calculate the padding
231 m_rowPaddingTop = numext::maxi<Index>(0, ((m_outputRows - 1) * m_row_strides + m_patch_rows_eff - m_input_rows_eff) / 2);
232 m_colPaddingLeft = numext::maxi<Index>(0, ((m_outputCols - 1) * m_col_strides + m_patch_cols_eff - m_input_cols_eff) / 2);
233 break;
234 case PADDING_SAME:
235 m_outputRows = numext::ceil(m_input_rows_eff / static_cast<float>(m_row_strides));
236 m_outputCols = numext::ceil(m_input_cols_eff / static_cast<float>(m_col_strides));
237 // Calculate the padding
238 m_rowPaddingTop = ((m_outputRows - 1) * m_row_strides + m_patch_rows_eff - m_input_rows_eff) / 2;
239 m_colPaddingLeft = ((m_outputCols - 1) * m_col_strides + m_patch_cols_eff - m_input_cols_eff) / 2;
240 break;
241 default:
242 eigen_assert(false && "unexpected padding");
243 }
244 }
245 eigen_assert(m_outputRows > 0);
246 eigen_assert(m_outputCols > 0);
247
248 // Dimensions for result of extraction.
249 if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
250 // ColMajor
251 // 0: depth
252 // 1: patch_rows
253 // 2: patch_cols
254 // 3: number of patches
255 // 4 and beyond: anything else (such as batch).
256 m_dimensions[0] = input_dims[0];
257 m_dimensions[1] = op.patch_rows();
258 m_dimensions[2] = op.patch_cols();
259 m_dimensions[3] = m_outputRows * m_outputCols;
260 for (int i = 4; i < NumDims; ++i) {
261 m_dimensions[i] = input_dims[i-1];
262 }
263 } else {
264 // RowMajor
265 // NumDims-1: depth
266 // NumDims-2: patch_rows
267 // NumDims-3: patch_cols
268 // NumDims-4: number of patches
269 // NumDims-5 and beyond: anything else (such as batch).
270 m_dimensions[NumDims-1] = input_dims[NumInputDims-1];
271 m_dimensions[NumDims-2] = op.patch_rows();
272 m_dimensions[NumDims-3] = op.patch_cols();
273 m_dimensions[NumDims-4] = m_outputRows * m_outputCols;
274 for (int i = NumDims-5; i >= 0; --i) {
275 m_dimensions[i] = input_dims[i];
276 }
277 }
278
279 // Strides for moving the patch in various dimensions.
280 if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
281 m_colStride = m_dimensions[1];
282 m_patchStride = m_colStride * m_dimensions[2] * m_dimensions[0];
283 m_otherStride = m_patchStride * m_dimensions[3];
284 } else {
285 m_colStride = m_dimensions[NumDims-2];
286 m_patchStride = m_colStride * m_dimensions[NumDims-3] * m_dimensions[NumDims-1];
287 m_otherStride = m_patchStride * m_dimensions[NumDims-4];
288 }
289
290 // Strides for navigating through the input tensor.
291 m_rowInputStride = m_inputDepth;
292 m_colInputStride = m_inputDepth * m_inputRows;
293 m_patchInputStride = m_inputDepth * m_inputRows * m_inputCols;
294
295 // Fast representations of different variables.
296 m_fastOtherStride = internal::TensorIntDivisor<Index>(m_otherStride);
297 m_fastPatchStride = internal::TensorIntDivisor<Index>(m_patchStride);
298 m_fastColStride = internal::TensorIntDivisor<Index>(m_colStride);
299 m_fastInflateRowStride = internal::TensorIntDivisor<Index>(m_row_inflate_strides);
300 m_fastInflateColStride = internal::TensorIntDivisor<Index>(m_col_inflate_strides);
301 m_fastInputColsEff = internal::TensorIntDivisor<Index>(m_input_cols_eff);
302
303 // Number of patches in the width dimension.
304 m_fastOutputRows = internal::TensorIntDivisor<Index>(m_outputRows);
305 if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
306 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[0]);
307 } else {
308 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[NumDims-1]);
309 }
310 }
311
312 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
313
314 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar* /*data*/) {
315 m_impl.evalSubExprsIfNeeded(NULL);
316 return true;
317 }
318
319 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup() {
320 m_impl.cleanup();
321 }
322
323 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
324 {
325 // Patch index corresponding to the passed in index.
326 const Index patchIndex = index / m_fastPatchStride;
327 // Find the offset of the element wrt the location of the first element.
328 const Index patchOffset = (index - patchIndex * m_patchStride) / m_fastOutputDepth;
329
330 // Other ways to index this element.
331 const Index otherIndex = (NumDims == 4) ? 0 : index / m_fastOtherStride;
332 const Index patch2DIndex = (NumDims == 4) ? patchIndex : (index - otherIndex * m_otherStride) / m_fastPatchStride;
333
334 // Calculate col index in the input original tensor.
335 const Index colIndex = patch2DIndex / m_fastOutputRows;
336 const Index colOffset = patchOffset / m_fastColStride;
337 const Index inputCol = colIndex * m_col_strides + colOffset * m_in_col_strides - m_colPaddingLeft;
338 const Index origInputCol = (m_col_inflate_strides == 1) ? inputCol : ((inputCol >= 0) ? (inputCol / m_fastInflateColStride) : 0);
339 if (inputCol < 0 || inputCol >= m_input_cols_eff ||
340 ((m_col_inflate_strides != 1) && (inputCol != origInputCol * m_col_inflate_strides))) {
341 return Scalar(m_paddingValue);
342 }
343
344 // Calculate row index in the original input tensor.
345 const Index rowIndex = patch2DIndex - colIndex * m_outputRows;
346 const Index rowOffset = patchOffset - colOffset * m_colStride;
347 const Index inputRow = rowIndex * m_row_strides + rowOffset * m_in_row_strides - m_rowPaddingTop;
348 const Index origInputRow = (m_row_inflate_strides == 1) ? inputRow : ((inputRow >= 0) ? (inputRow / m_fastInflateRowStride) : 0);
349 if (inputRow < 0 || inputRow >= m_input_rows_eff ||
350 ((m_row_inflate_strides != 1) && (inputRow != origInputRow * m_row_inflate_strides))) {
351 return Scalar(m_paddingValue);
352 }
353
354 const int depth_index = static_cast<int>(Layout) == static_cast<int>(ColMajor) ? 0 : NumDims - 1;
355 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
356
357 const Index inputIndex = depth + origInputRow * m_rowInputStride + origInputCol * m_colInputStride + otherIndex * m_patchInputStride;
358 return m_impl.coeff(inputIndex);
359 }
360
361 template<int LoadMode>
362 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
363 {
364 EIGEN_STATIC_ASSERT((PacketSize > 1), YOU_MADE_A_PROGRAMMING_MISTAKE)
365 eigen_assert(index+PacketSize-1 < dimensions().TotalSize());
366
367 if (m_in_row_strides != 1 || m_in_col_strides != 1 || m_row_inflate_strides != 1 || m_col_inflate_strides != 1) {
368 return packetWithPossibleZero(index);
369 }
370
371 const Index indices[2] = {index, index + PacketSize - 1};
372 const Index patchIndex = indices[0] / m_fastPatchStride;
373 if (patchIndex != indices[1] / m_fastPatchStride) {
374 return packetWithPossibleZero(index);
375 }
376 const Index otherIndex = (NumDims == 4) ? 0 : indices[0] / m_fastOtherStride;
377 eigen_assert(otherIndex == indices[1] / m_fastOtherStride);
378
379 // Find the offset of the element wrt the location of the first element.
380 const Index patchOffsets[2] = {(indices[0] - patchIndex * m_patchStride) / m_fastOutputDepth,
381 (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth};
382
383 const Index patch2DIndex = (NumDims == 4) ? patchIndex : (indices[0] - otherIndex * m_otherStride) / m_fastPatchStride;
384 eigen_assert(patch2DIndex == (indices[1] - otherIndex * m_otherStride) / m_fastPatchStride);
385
386 const Index colIndex = patch2DIndex / m_fastOutputRows;
387 const Index colOffsets[2] = {patchOffsets[0] / m_fastColStride, patchOffsets[1] / m_fastColStride};
388
389 // Calculate col indices in the original input tensor.
390 const Index inputCols[2] = {colIndex * m_col_strides + colOffsets[0] -
391 m_colPaddingLeft, colIndex * m_col_strides + colOffsets[1] - m_colPaddingLeft};
392 if (inputCols[1] < 0 || inputCols[0] >= m_inputCols) {
393 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
394 }
395
396 if (inputCols[0] == inputCols[1]) {
397 const Index rowIndex = patch2DIndex - colIndex * m_outputRows;
398 const Index rowOffsets[2] = {patchOffsets[0] - colOffsets[0]*m_colStride, patchOffsets[1] - colOffsets[1]*m_colStride};
399 eigen_assert(rowOffsets[0] <= rowOffsets[1]);
400 // Calculate col indices in the original input tensor.
401 const Index inputRows[2] = {rowIndex * m_row_strides + rowOffsets[0] -
402 m_rowPaddingTop, rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop};
403
404 if (inputRows[1] < 0 || inputRows[0] >= m_inputRows) {
405 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
406 }
407
408 if (inputRows[0] >= 0 && inputRows[1] < m_inputRows) {
409 // no padding
410 const int depth_index = static_cast<int>(Layout) == static_cast<int>(ColMajor) ? 0 : NumDims - 1;
411 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
412 const Index inputIndex = depth + inputRows[0] * m_rowInputStride + inputCols[0] * m_colInputStride + otherIndex * m_patchInputStride;
413 return m_impl.template packet<Unaligned>(inputIndex);
414 }
415 }
416
417 return packetWithPossibleZero(index);
418 }
419
420 EIGEN_DEVICE_FUNC Scalar* data() const { return NULL; }
421
422 const TensorEvaluator<ArgType, Device>& impl() const { return m_impl; }
423
424 Index rowPaddingTop() const { return m_rowPaddingTop; }
425 Index colPaddingLeft() const { return m_colPaddingLeft; }
426 Index outputRows() const { return m_outputRows; }
427 Index outputCols() const { return m_outputCols; }
428 Index userRowStride() const { return m_row_strides; }
429 Index userColStride() const { return m_col_strides; }
430 Index userInRowStride() const { return m_in_row_strides; }
431 Index userInColStride() const { return m_in_col_strides; }
432 Index rowInflateStride() const { return m_row_inflate_strides; }
433 Index colInflateStride() const { return m_col_inflate_strides; }
434
435 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost
436 costPerCoeff(bool vectorized) const {
437 // We conservatively estimate the cost for the code path where the computed
438 // index is inside the original image and
439 // TensorEvaluator<ArgType, Device>::CoordAccess is false.
440 const double compute_cost = 3 * TensorOpCost::DivCost<Index>() +
441 6 * TensorOpCost::MulCost<Index>() +
442 8 * TensorOpCost::MulCost<Index>();
443 return m_impl.costPerCoeff(vectorized) +
444 TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
445 }
446
447 protected:
448 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
449 {
450 EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[PacketSize];
451 for (int i = 0; i < PacketSize; ++i) {
452 values[i] = coeff(index+i);
453 }
454 PacketReturnType rslt = internal::pload<PacketReturnType>(values);
455 return rslt;
456 }
457
458 Dimensions m_dimensions;
459
460 Index m_otherStride;
461 Index m_patchStride;
462 Index m_colStride;
463 Index m_row_strides;
464 Index m_col_strides;
465
466 Index m_in_row_strides;
467 Index m_in_col_strides;
468 Index m_row_inflate_strides;
469 Index m_col_inflate_strides;
470
471 Index m_input_rows_eff;
472 Index m_input_cols_eff;
473 Index m_patch_rows_eff;
474 Index m_patch_cols_eff;
475
476 internal::TensorIntDivisor<Index> m_fastOtherStride;
477 internal::TensorIntDivisor<Index> m_fastPatchStride;
478 internal::TensorIntDivisor<Index> m_fastColStride;
479 internal::TensorIntDivisor<Index> m_fastInflateRowStride;
480 internal::TensorIntDivisor<Index> m_fastInflateColStride;
481 internal::TensorIntDivisor<Index> m_fastInputColsEff;
482
483 Index m_rowInputStride;
484 Index m_colInputStride;
485 Index m_patchInputStride;
486
487 Index m_inputDepth;
488 Index m_inputRows;
489 Index m_inputCols;
490
491 Index m_outputRows;
492 Index m_outputCols;
493
494 Index m_rowPaddingTop;
495 Index m_colPaddingLeft;
496
497 internal::TensorIntDivisor<Index> m_fastOutputRows;
498 internal::TensorIntDivisor<Index> m_fastOutputDepth;
499
500 Scalar m_paddingValue;
501
502 TensorEvaluator<ArgType, Device> m_impl;
503};
504
505
506} // end namespace Eigen
507
508#endif // EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
The tensor base class.
Definition TensorForwardDeclarations.h:29
Patch extraction specialized for image processing. This assumes that the input has a least 3 dimensio...
Definition TensorImagePatch.h:58
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The tensor evaluator class.
Definition TensorEvaluator.h:27
const Device & device() const
required by sycl in order to construct sycl buffer from raw pointer
Definition TensorEvaluator.h:112