TensorImagePatch.h
Go to the documentation of this file.
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 
13 #include "./InternalHeaderCheck.h"
14 
15 namespace Eigen {
16 
31 namespace internal {
32 
33 template<DenseIndex Rows, DenseIndex Cols, typename XprType>
34 struct traits<TensorImagePatchOp<Rows, Cols, XprType> > : public traits<XprType>
35 {
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;
45 };
46 
47 template<DenseIndex Rows, DenseIndex Cols, typename XprType>
48 struct eval<TensorImagePatchOp<Rows, Cols, XprType>, Eigen::Dense>
49 {
50  typedef const TensorImagePatchOp<Rows, Cols, XprType>& type;
51 };
52 
53 template<DenseIndex Rows, DenseIndex Cols, typename XprType>
54 struct nested<TensorImagePatchOp<Rows, Cols, XprType>, 1, typename eval<TensorImagePatchOp<Rows, Cols, XprType> >::type>
55 {
56  typedef TensorImagePatchOp<Rows, Cols, XprType> type;
57 };
58 
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);
70  }
71  }
72 };
73 
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);
90  }
91  for (Index i = vectorized_size; i < num_coeff_to_copy; ++i) {
92  dst_data[dst_index + i] = impl.coeff(src_index + i);
93  }
94  }
95 };
96 
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,
111  padded_packet);
112  }
113  for (Index i = vectorized_size; i < num_coeff_to_pad; ++i) {
114  dst_data[dst_index + i] = padding_value;
115  }
116  }
117 };
118 
119 } // end namespace internal
120 
121 template<DenseIndex Rows, DenseIndex Cols, typename XprType>
122 class TensorImagePatchOp : public TensorBase<TensorImagePatchOp<Rows, Cols, XprType>, ReadOnlyAccessors>
123 {
124  public:
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;
131 
143 
158 
159 
161  DenseIndex patch_rows() const { return m_patch_rows; }
163  DenseIndex patch_cols() const { return m_patch_cols; }
177  bool padding_explicit() const { return m_padding_explicit; }
190 
193  expression() const { return m_xpr; }
194 
195  protected:
196  typename XprType::Nested m_xpr;
205  const bool m_padding_explicit;
212 };
213 
214 // Eval as rvalue
215 template<DenseIndex Rows, DenseIndex Cols, typename ArgType, typename Device>
216 struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
217 {
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;
223  typedef std::remove_const_t<typename XprType::Scalar> Scalar;
225  Device> Self;
232 
234  enum {
235  IsAligned = false,
237  BlockAccess = false,
238  PreferBlockAccess = true,
239  CoordAccess = false,
240  RawAccess = false
241  };
242 
243  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
244  typedef internal::TensorBlockNotImplemented TensorBlock;
245  //===--------------------------------------------------------------------===//
246 
247  EIGEN_STRONG_INLINE TensorEvaluator( const XprType& op, const Device& device)
248  : m_device(device), m_impl(op.expression(), device)
249  {
250  EIGEN_STATIC_ASSERT((NumDims >= 4), YOU_MADE_A_PROGRAMMING_MISTAKE);
251 
252  m_paddingValue = op.padding_value();
253 
254  const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
255 
256  // Caches a few variables.
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];
261  } else {
262  m_inputDepth = input_dims[NumInputDims-1];
263  m_inputRows = input_dims[NumInputDims-2];
264  m_inputCols = input_dims[NumInputDims-3];
265  }
266 
267  m_row_strides = op.row_strides();
268  m_col_strides = op.col_strides();
269 
270  // Input strides and effective input/patch size
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();
275  // The "effective" input rows and input cols are the input rows and cols
276  // after inflating them with zeros.
277  // For examples, a 2x3 matrix with row_inflate_strides and
278  // col_inflate_strides of 2 comes from:
279  // A B C
280  // D E F
281  //
282  // to a matrix is 3 x 5:
283  //
284  // A . B . C
285  // . . . . .
286  // D . E . F
287 
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);
292 
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();
298  } else {
299  // Computing padding from the type
300  switch (op.padding_type()) {
301  case PADDING_VALID:
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));
304  // Calculate the padding
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);
307  break;
308  case PADDING_SAME:
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));
311  // Calculate the padding
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;
314  // The padding size calculation for PADDING_SAME has been updated to
315  // be consistent with how TensorFlow extracts its paddings.
316  m_rowPaddingTop = numext::maxi<Index>(0, m_rowPaddingTop);
317  m_colPaddingLeft = numext::maxi<Index>(0, m_colPaddingLeft);
318  break;
319  default:
320  eigen_assert(false && "unexpected padding");
321  m_outputCols=0; // silence the uninitialised warning;
322  m_outputRows=0;
323  }
324  }
325  eigen_assert(m_outputRows > 0);
326  eigen_assert(m_outputCols > 0);
327 
328  // Dimensions for result of extraction.
329  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
330  // ColMajor
331  // 0: depth
332  // 1: patch_rows
333  // 2: patch_cols
334  // 3: number of patches
335  // 4 and beyond: anything else (such as batch).
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];
342  }
343  } else {
344  // RowMajor
345  // NumDims-1: depth
346  // NumDims-2: patch_rows
347  // NumDims-3: patch_cols
348  // NumDims-4: number of patches
349  // NumDims-5 and beyond: anything else (such as batch).
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];
356  }
357  }
358 
359  // Strides for moving the patch in various dimensions.
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];
364  } else {
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];
368  }
369 
370  // Strides for navigating through the input tensor.
371  m_rowInputStride = m_inputDepth;
372  m_colInputStride = m_inputDepth * m_inputRows;
373  m_patchInputStride = m_inputDepth * m_inputRows * m_inputCols;
374 
375  // Fast representations of different variables.
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);
382 
383  // Number of patches in the width dimension.
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]);
387  } else {
388  m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[NumDims-1]);
389  }
390  }
391 
392  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
393 
394  EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType /*data*/) {
395  m_impl.evalSubExprsIfNeeded(NULL);
396  return true;
397  }
398 
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); });
404  }
405 #endif // EIGEN_USE_THREADS
406 
407  EIGEN_STRONG_INLINE void cleanup() {
408  m_impl.cleanup();
409  }
410 
411  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
412  {
413  // Patch index corresponding to the passed in index.
414  const Index patchIndex = index / m_fastPatchStride;
415  // Find the offset of the element wrt the location of the first element.
416  const Index patchOffset = (index - patchIndex * m_patchStride) / m_fastOutputDepth;
417 
418  // Other ways to index this element.
419  const Index otherIndex = (NumDims == 4) ? 0 : index / m_fastOtherStride;
420  const Index patch2DIndex = (NumDims == 4) ? patchIndex : (index - otherIndex * m_otherStride) / m_fastPatchStride;
421 
422  // Calculate col index in the input original tensor.
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);
430  }
431 
432  // Calculate row index in the original input tensor.
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);
440  }
441 
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];
444 
445  const Index inputIndex = depth + origInputRow * m_rowInputStride + origInputCol * m_colInputStride + otherIndex * m_patchInputStride;
446  return m_impl.coeff(inputIndex);
447  }
448 
449  template<int LoadMode>
450  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
451  {
452  eigen_assert(index+PacketSize-1 < dimensions().TotalSize());
453 
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);
456  }
457 
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);
462  }
463  const Index otherIndex = (NumDims == 4) ? 0 : indices[0] / m_fastOtherStride;
464  eigen_assert(otherIndex == indices[1] / m_fastOtherStride);
465 
466  // Find the offset of the element wrt the location of the first element.
467  const Index patchOffsets[2] = {(indices[0] - patchIndex * m_patchStride) / m_fastOutputDepth,
468  (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth};
469 
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);
472 
473  const Index colIndex = patch2DIndex / m_fastOutputRows;
474  const Index colOffsets[2] = {patchOffsets[0] / m_fastColStride, patchOffsets[1] / m_fastColStride};
475 
476  // Calculate col indices in the original input tensor.
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));
481  }
482 
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]);
487  // Calculate col indices in the original input tensor.
488  const Index inputRows[2] = {rowIndex * m_row_strides + rowOffsets[0] -
489  m_rowPaddingTop, rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop};
490 
491  if (inputRows[1] < 0 || inputRows[0] >= m_inputRows) {
492  return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
493  }
494 
495  if (inputRows[0] >= 0 && inputRows[1] < m_inputRows) {
496  // no padding
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);
501  }
502  }
503 
504  return packetWithPossibleZero(index);
505  }
506 
507  EIGEN_DEVICE_FUNC EvaluatorPointerType data() const { return NULL; }
508 
509  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorEvaluator<ArgType, Device>& impl() const { return m_impl; }
510  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowPaddingTop() const { return m_rowPaddingTop; }
511  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colPaddingLeft() const { return m_colPaddingLeft; }
512  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index outputRows() const { return m_outputRows; }
513  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index outputCols() const { return m_outputCols; }
514  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index userRowStride() const { return m_row_strides; }
515  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index userColStride() const { return m_col_strides; }
516  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index userInRowStride() const { return m_in_row_strides; }
517  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index userInColStride() const { return m_in_col_strides; }
518  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowInflateStride() const { return m_row_inflate_strides; }
519  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colInflateStride() const { return m_col_inflate_strides; }
520 
521  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost
522  costPerCoeff(bool vectorized) const {
523  // We conservatively estimate the cost for the code path where the computed
524  // index is inside the original image and
525  // TensorEvaluator<ArgType, Device>::CoordAccess is false.
526  const double compute_cost = 3 * TensorOpCost::DivCost<Index>() +
527  6 * TensorOpCost::MulCost<Index>() +
528  8 * TensorOpCost::MulCost<Index>();
529  return m_impl.costPerCoeff(vectorized) +
530  TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
531  }
532 
533  protected:
535  {
536  EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[PacketSize];
538  for (int i = 0; i < PacketSize; ++i) {
539  values[i] = coeff(index+i);
540  }
541  PacketReturnType rslt = internal::pload<PacketReturnType>(values);
542  return rslt;
543  }
544 
546 
552 
557 
562 
563  internal::TensorIntDivisor<Index> m_fastOtherStride;
564  internal::TensorIntDivisor<Index> m_fastPatchStride;
565  internal::TensorIntDivisor<Index> m_fastColStride;
566  internal::TensorIntDivisor<Index> m_fastInflateRowStride;
567  internal::TensorIntDivisor<Index> m_fastInflateColStride;
568  internal::TensorIntDivisor<Index> m_fastInputColsEff;
569 
573 
577 
580 
583 
584  internal::TensorIntDivisor<Index> m_fastOutputRows;
585  internal::TensorIntDivisor<Index> m_fastOutputDepth;
586 
588 
591 };
592 
593 
594 } // end namespace Eigen
595 
596 #endif // EIGEN_CXX11_TENSOR_TENSOR_IMAGE_PATCH_H
int i
#define EIGEN_ALIGN_MAX
#define EIGEN_UNROLL_LOOP
#define EIGEN_DEVICE_FUNC
#define eigen_assert(x)
#define EIGEN_STATIC_ASSERT(X, MSG)
#define EIGEN_DEVICE_REF
Definition: TensorMacros.h:36
float * p
The tensor base class.
DenseIndex padding_right() const
DenseIndex in_col_strides() const
TensorImagePatchOp(const XprType &expr, DenseIndex patch_rows, DenseIndex patch_cols, DenseIndex row_strides, DenseIndex col_strides, DenseIndex in_row_strides, DenseIndex in_col_strides, DenseIndex row_inflate_strides, DenseIndex col_inflate_strides, PaddingType padding_type, Scalar padding_value)
PaddingType padding_type() const
const DenseIndex m_padding_bottom
DenseIndex row_strides() const
const internal::remove_all_t< typename XprType::Nested > & expression() const
DenseIndex patch_cols() const
const DenseIndex m_in_col_strides
const DenseIndex m_row_strides
TensorImagePatchOp(const XprType &expr, DenseIndex patch_rows, DenseIndex patch_cols, DenseIndex row_strides, DenseIndex col_strides, DenseIndex in_row_strides, DenseIndex in_col_strides, DenseIndex row_inflate_strides, DenseIndex col_inflate_strides, DenseIndex padding_top, DenseIndex padding_bottom, DenseIndex padding_left, DenseIndex padding_right, Scalar padding_value)
const DenseIndex m_padding_right
XprType::CoeffReturnType CoeffReturnType
DenseIndex padding_top() const
const DenseIndex m_padding_left
Eigen::internal::traits< TensorImagePatchOp >::Scalar Scalar
const DenseIndex m_patch_rows
DenseIndex in_row_strides() const
DenseIndex padding_bottom() const
DenseIndex padding_left() const
const DenseIndex m_in_row_strides
const DenseIndex m_col_strides
const DenseIndex m_row_inflate_strides
const PaddingType m_padding_type
DenseIndex row_inflate_strides() const
DenseIndex patch_rows() const
DenseIndex col_strides() const
Eigen::internal::nested< TensorImagePatchOp >::type Nested
Eigen::internal::traits< TensorImagePatchOp >::Index Index
Eigen::internal::traits< TensorImagePatchOp >::StorageKind StorageKind
DenseIndex col_inflate_strides() const
const DenseIndex m_col_inflate_strides
const DenseIndex m_padding_top
const DenseIndex m_patch_cols
Eigen::NumTraits< Scalar >::Real RealScalar
typename remove_all< T >::type remove_all_t
Scalar() ceil(const Scalar &x)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
@ PADDING_VALID
Definition: TensorTraits.h:260
@ PADDING_SAME
Definition: TensorTraits.h:261
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
internal::packet_traits< Scalar >::type type
Definition: TensorMeta.h:55
TensorEvaluator< const TensorImagePatchOp< Rows, Cols, ArgType >, Device > Self
A cost model used to limit the number of threads used for evaluating tensor expression.
const Dimensions & dimensions() const
static constexpr int Layout
Derived::Scalar Scalar
const Device EIGEN_DEVICE_REF m_device
CoeffReturnType coeff(Index index) const
Storage::Type EvaluatorPointerType
static constexpr int PacketSize