4#ifndef EIGEN_CXX11_TENSOR_TENSOR_VOLUME_PATCH_H
5#define EIGEN_CXX11_TENSOR_TENSOR_VOLUME_PATCH_H
10template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols,
typename XprType>
11struct traits<TensorVolumePatchOp<Planes, Rows, Cols, XprType> > :
public traits<XprType>
13 typedef typename internal::remove_const<typename XprType::Scalar>::type Scalar;
14 typedef traits<XprType> XprTraits;
15 typedef typename XprTraits::StorageKind StorageKind;
16 typedef typename XprTraits::Index
Index;
17 typedef typename XprType::Nested Nested;
18 typedef typename remove_reference<Nested>::type _Nested;
19 static const int NumDimensions = XprTraits::NumDimensions + 1;
20 static const int Layout = XprTraits::Layout;
23template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols,
typename XprType>
24struct eval<TensorVolumePatchOp<Planes, Rows, Cols, XprType>, Eigen::Dense>
26 typedef const TensorVolumePatchOp<Planes, Rows, Cols, XprType>& type;
29template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols,
typename XprType>
30struct nested<TensorVolumePatchOp<Planes, Rows, Cols, XprType>, 1, typename eval<TensorVolumePatchOp<Planes, Rows, Cols, XprType> >::type>
32 typedef TensorVolumePatchOp<Planes, Rows, Cols, XprType> type;
52template <DenseIndex Planes, DenseIndex Rows, DenseIndex Cols,
typename XprType>
53class TensorVolumePatchOp :
public TensorBase<TensorVolumePatchOp<Planes, Rows, Cols, XprType>, ReadOnlyAccessors> {
55 typedef typename Eigen::internal::traits<TensorVolumePatchOp>::Scalar Scalar;
57 typedef typename XprType::CoeffReturnType CoeffReturnType;
58 typedef typename Eigen::internal::nested<TensorVolumePatchOp>::type Nested;
59 typedef typename Eigen::internal::traits<TensorVolumePatchOp>::StorageKind StorageKind;
60 typedef typename Eigen::internal::traits<TensorVolumePatchOp>::Index Index;
62 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorVolumePatchOp(
const XprType& expr, DenseIndex patch_planes, DenseIndex patch_rows, DenseIndex patch_cols,
63 DenseIndex plane_strides, DenseIndex row_strides, DenseIndex col_strides,
64 DenseIndex in_plane_strides, DenseIndex in_row_strides, DenseIndex in_col_strides,
65 DenseIndex plane_inflate_strides, DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
66 PaddingType padding_type, Scalar padding_value)
67 : m_xpr(expr), m_patch_planes(patch_planes), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
68 m_plane_strides(plane_strides), m_row_strides(row_strides), m_col_strides(col_strides),
69 m_in_plane_strides(in_plane_strides), m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
70 m_plane_inflate_strides(plane_inflate_strides), m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
71 m_padding_explicit(
false), m_padding_top_z(0), m_padding_bottom_z(0), m_padding_top(0), m_padding_bottom(0), m_padding_left(0), m_padding_right(0),
72 m_padding_type(padding_type), m_padding_value(padding_value) {}
74 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorVolumePatchOp(
const XprType& expr, DenseIndex patch_planes, DenseIndex patch_rows, DenseIndex patch_cols,
75 DenseIndex plane_strides, DenseIndex row_strides, DenseIndex col_strides,
76 DenseIndex in_plane_strides, DenseIndex in_row_strides, DenseIndex in_col_strides,
77 DenseIndex plane_inflate_strides, DenseIndex row_inflate_strides, DenseIndex col_inflate_strides,
78 DenseIndex padding_top_z, DenseIndex padding_bottom_z,
79 DenseIndex padding_top, DenseIndex padding_bottom,
80 DenseIndex padding_left, DenseIndex padding_right,
82 : m_xpr(expr), m_patch_planes(patch_planes), m_patch_rows(patch_rows), m_patch_cols(patch_cols),
83 m_plane_strides(plane_strides), m_row_strides(row_strides), m_col_strides(col_strides),
84 m_in_plane_strides(in_plane_strides), m_in_row_strides(in_row_strides), m_in_col_strides(in_col_strides),
85 m_plane_inflate_strides(plane_inflate_strides), m_row_inflate_strides(row_inflate_strides), m_col_inflate_strides(col_inflate_strides),
86 m_padding_explicit(
true), m_padding_top_z(padding_top_z), m_padding_bottom_z(padding_bottom_z), m_padding_top(padding_top), m_padding_bottom(padding_bottom),
87 m_padding_left(padding_left), m_padding_right(padding_right),
88 m_padding_type(PADDING_VALID), m_padding_value(padding_value) {}
91 DenseIndex patch_planes()
const {
return m_patch_planes; }
93 DenseIndex patch_rows()
const {
return m_patch_rows; }
95 DenseIndex patch_cols()
const {
return m_patch_cols; }
97 DenseIndex plane_strides()
const {
return m_plane_strides; }
99 DenseIndex row_strides()
const {
return m_row_strides; }
101 DenseIndex col_strides()
const {
return m_col_strides; }
103 DenseIndex in_plane_strides()
const {
return m_in_plane_strides; }
105 DenseIndex in_row_strides()
const {
return m_in_row_strides; }
107 DenseIndex in_col_strides()
const {
return m_in_col_strides; }
109 DenseIndex plane_inflate_strides()
const {
return m_plane_inflate_strides; }
111 DenseIndex row_inflate_strides()
const {
return m_row_inflate_strides; }
113 DenseIndex col_inflate_strides()
const {
return m_col_inflate_strides; }
115 bool padding_explicit()
const {
return m_padding_explicit; }
117 DenseIndex padding_top_z()
const {
return m_padding_top_z; }
119 DenseIndex padding_bottom_z()
const {
return m_padding_bottom_z; }
121 DenseIndex padding_top()
const {
return m_padding_top; }
123 DenseIndex padding_bottom()
const {
return m_padding_bottom; }
125 DenseIndex padding_left()
const {
return m_padding_left; }
127 DenseIndex padding_right()
const {
return m_padding_right; }
129 PaddingType padding_type()
const {
return m_padding_type; }
131 Scalar padding_value()
const {
return m_padding_value; }
134 const typename internal::remove_all<typename XprType::Nested>::type&
135 expression()
const {
return m_xpr; }
138 typename XprType::Nested m_xpr;
139 const DenseIndex m_patch_planes;
140 const DenseIndex m_patch_rows;
141 const DenseIndex m_patch_cols;
142 const DenseIndex m_plane_strides;
143 const DenseIndex m_row_strides;
144 const DenseIndex m_col_strides;
145 const DenseIndex m_in_plane_strides;
146 const DenseIndex m_in_row_strides;
147 const DenseIndex m_in_col_strides;
148 const DenseIndex m_plane_inflate_strides;
149 const DenseIndex m_row_inflate_strides;
150 const DenseIndex m_col_inflate_strides;
151 const bool m_padding_explicit;
152 const DenseIndex m_padding_top_z;
153 const DenseIndex m_padding_bottom_z;
154 const DenseIndex m_padding_top;
155 const DenseIndex m_padding_bottom;
156 const DenseIndex m_padding_left;
157 const DenseIndex m_padding_right;
158 const PaddingType m_padding_type;
159 const Scalar m_padding_value;
164template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols,
typename ArgType,
typename Device>
168 typedef typename XprType::Index
Index;
169 static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
170 static const int NumDims = NumInputDims + 1;
172 typedef typename internal::remove_const<typename XprType::Scalar>::type
Scalar;
173 typedef typename XprType::CoeffReturnType CoeffReturnType;
174 typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
175 static const int PacketSize = internal::unpacket_traits<PacketReturnType>::size;
179 PacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess,
181 Layout = TensorEvaluator<ArgType, Device>::Layout,
186 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(
const XprType& op,
const Device&
device)
187 : m_impl(op.expression(),
device)
189 EIGEN_STATIC_ASSERT((NumDims >= 5), YOU_MADE_A_PROGRAMMING_MISTAKE);
191 m_paddingValue = op.padding_value();
193 const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
196 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
197 m_inputDepth = input_dims[0];
198 m_inputPlanes = input_dims[1];
199 m_inputRows = input_dims[2];
200 m_inputCols = input_dims[3];
202 m_inputDepth = input_dims[NumInputDims-1];
203 m_inputPlanes = input_dims[NumInputDims-2];
204 m_inputRows = input_dims[NumInputDims-3];
205 m_inputCols = input_dims[NumInputDims-4];
208 m_plane_strides = op.plane_strides();
209 m_row_strides = op.row_strides();
210 m_col_strides = op.col_strides();
213 m_in_plane_strides = op.in_plane_strides();
214 m_in_row_strides = op.in_row_strides();
215 m_in_col_strides = op.in_col_strides();
216 m_plane_inflate_strides = op.plane_inflate_strides();
217 m_row_inflate_strides = op.row_inflate_strides();
218 m_col_inflate_strides = op.col_inflate_strides();
221 m_input_planes_eff = (m_inputPlanes - 1) * m_plane_inflate_strides + 1;
222 m_input_rows_eff = (m_inputRows - 1) * m_row_inflate_strides + 1;
223 m_input_cols_eff = (m_inputCols - 1) * m_col_inflate_strides + 1;
224 m_patch_planes_eff = op.patch_planes() + (op.patch_planes() - 1) * (m_in_plane_strides - 1);
225 m_patch_rows_eff = op.patch_rows() + (op.patch_rows() - 1) * (m_in_row_strides - 1);
226 m_patch_cols_eff = op.patch_cols() + (op.patch_cols() - 1) * (m_in_col_strides - 1);
228 if (op.padding_explicit()) {
229 m_outputPlanes = numext::ceil((m_input_planes_eff + op.padding_top_z() + op.padding_bottom_z() - m_patch_planes_eff + 1.f) /
static_cast<float>(m_plane_strides));
230 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));
231 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));
232 m_planePaddingTop = op.padding_top_z();
233 m_rowPaddingTop = op.padding_top();
234 m_colPaddingLeft = op.padding_left();
237 switch (op.padding_type()) {
239 m_outputPlanes = numext::ceil((m_input_planes_eff - m_patch_planes_eff + 1.f) /
static_cast<float>(m_plane_strides));
240 m_outputRows = numext::ceil((m_input_rows_eff - m_patch_rows_eff + 1.f) /
static_cast<float>(m_row_strides));
241 m_outputCols = numext::ceil((m_input_cols_eff - m_patch_cols_eff + 1.f) /
static_cast<float>(m_col_strides));
242 m_planePaddingTop = 0;
244 m_colPaddingLeft = 0;
247 m_outputPlanes = numext::ceil(m_input_planes_eff /
static_cast<float>(m_plane_strides));
248 m_outputRows = numext::ceil(m_input_rows_eff /
static_cast<float>(m_row_strides));
249 m_outputCols = numext::ceil(m_input_cols_eff /
static_cast<float>(m_col_strides));
250 const Index dz = m_outputPlanes * m_plane_strides + m_patch_planes_eff - 1 - m_input_planes_eff;
251 const Index dy = m_outputRows * m_row_strides + m_patch_rows_eff - 1 - m_input_rows_eff;
252 const Index dx = m_outputCols * m_col_strides + m_patch_cols_eff - 1 - m_input_cols_eff;
253 m_planePaddingTop = dz - dz / 2;
254 m_rowPaddingTop = dy - dy / 2;
255 m_colPaddingLeft = dx - dx / 2;
259 eigen_assert(
false &&
"unexpected padding");
262 eigen_assert(m_outputRows > 0);
263 eigen_assert(m_outputCols > 0);
264 eigen_assert(m_outputPlanes > 0);
267 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
275 m_dimensions[0] = input_dims[0];
276 m_dimensions[1] = op.patch_planes();
277 m_dimensions[2] = op.patch_rows();
278 m_dimensions[3] = op.patch_cols();
279 m_dimensions[4] = m_outputPlanes * m_outputRows * m_outputCols;
280 for (
int i = 5; i < NumDims; ++i) {
281 m_dimensions[i] = input_dims[i-1];
291 m_dimensions[NumDims-1] = input_dims[NumInputDims-1];
292 m_dimensions[NumDims-2] = op.patch_planes();
293 m_dimensions[NumDims-3] = op.patch_rows();
294 m_dimensions[NumDims-4] = op.patch_cols();
295 m_dimensions[NumDims-5] = m_outputPlanes * m_outputRows * m_outputCols;
296 for (
int i = NumDims-6; i >= 0; --i) {
297 m_dimensions[i] = input_dims[i];
302 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
303 m_rowStride = m_dimensions[1];
304 m_colStride = m_dimensions[2] * m_rowStride;
305 m_patchStride = m_colStride * m_dimensions[3] * m_dimensions[0];
306 m_otherStride = m_patchStride * m_dimensions[4];
308 m_rowStride = m_dimensions[NumDims-2];
309 m_colStride = m_dimensions[NumDims-3] * m_rowStride;
310 m_patchStride = m_colStride * m_dimensions[NumDims-4] * m_dimensions[NumDims-1];
311 m_otherStride = m_patchStride * m_dimensions[NumDims-5];
315 m_planeInputStride = m_inputDepth;
316 m_rowInputStride = m_inputDepth * m_inputPlanes;
317 m_colInputStride = m_inputDepth * m_inputRows * m_inputPlanes;
318 m_otherInputStride = m_inputDepth * m_inputRows * m_inputCols * m_inputPlanes;
320 m_outputPlanesRows = m_outputPlanes * m_outputRows;
323 m_fastOtherStride = internal::TensorIntDivisor<Index>(m_otherStride);
324 m_fastPatchStride = internal::TensorIntDivisor<Index>(m_patchStride);
325 m_fastColStride = internal::TensorIntDivisor<Index>(m_colStride);
326 m_fastRowStride = internal::TensorIntDivisor<Index>(m_rowStride);
327 m_fastInputRowStride = internal::TensorIntDivisor<Index>(m_row_inflate_strides);
328 m_fastInputColStride = internal::TensorIntDivisor<Index>(m_col_inflate_strides);
329 m_fastInputPlaneStride = internal::TensorIntDivisor<Index>(m_plane_inflate_strides);
330 m_fastInputColsEff = internal::TensorIntDivisor<Index>(m_input_cols_eff);
331 m_fastOutputPlanes = internal::TensorIntDivisor<Index>(m_outputPlanes);
332 m_fastOutputPlanesRows = internal::TensorIntDivisor<Index>(m_outputPlanesRows);
334 if (
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor)) {
335 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[0]);
337 m_fastOutputDepth = internal::TensorIntDivisor<Index>(m_dimensions[NumDims-1]);
341 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Dimensions& dimensions()
const {
return m_dimensions; }
343 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool evalSubExprsIfNeeded(Scalar* ) {
344 m_impl.evalSubExprsIfNeeded(NULL);
348 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void cleanup() {
352 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index)
const
355 const Index patchIndex = index / m_fastPatchStride;
359 const Index patchOffset = (index - patchIndex * m_patchStride) / m_fastOutputDepth;
362 const Index otherIndex = (NumDims == 5) ? 0 : index / m_fastOtherStride;
363 const Index patch3DIndex = (NumDims == 5) ? patchIndex : (index - otherIndex * m_otherStride) / m_fastPatchStride;
366 const Index colIndex = patch3DIndex / m_fastOutputPlanesRows;
367 const Index colOffset = patchOffset / m_fastColStride;
368 const Index inputCol = colIndex * m_col_strides + colOffset * m_in_col_strides - m_colPaddingLeft;
369 const Index origInputCol = (m_col_inflate_strides == 1) ? inputCol : ((inputCol >= 0) ? (inputCol / m_fastInputColStride) : 0);
370 if (inputCol < 0 || inputCol >= m_input_cols_eff ||
371 ((m_col_inflate_strides != 1) && (inputCol != origInputCol * m_col_inflate_strides))) {
372 return Scalar(m_paddingValue);
376 const Index rowIndex = (patch3DIndex - colIndex * m_outputPlanesRows) / m_fastOutputPlanes;
377 const Index rowOffset = (patchOffset - colOffset * m_colStride) / m_fastRowStride;
378 const Index inputRow = rowIndex * m_row_strides + rowOffset * m_in_row_strides - m_rowPaddingTop;
379 const Index origInputRow = (m_row_inflate_strides == 1) ? inputRow : ((inputRow >= 0) ? (inputRow / m_fastInputRowStride) : 0);
380 if (inputRow < 0 || inputRow >= m_input_rows_eff ||
381 ((m_row_inflate_strides != 1) && (inputRow != origInputRow * m_row_inflate_strides))) {
382 return Scalar(m_paddingValue);
386 const Index planeIndex = (patch3DIndex - m_outputPlanes * (colIndex * m_outputRows + rowIndex));
387 const Index planeOffset = patchOffset - colOffset * m_colStride - rowOffset * m_rowStride;
388 const Index inputPlane = planeIndex * m_plane_strides + planeOffset * m_in_plane_strides - m_planePaddingTop;
389 const Index origInputPlane = (m_plane_inflate_strides == 1) ? inputPlane : ((inputPlane >= 0) ? (inputPlane / m_fastInputPlaneStride) : 0);
390 if (inputPlane < 0 || inputPlane >= m_input_planes_eff ||
391 ((m_plane_inflate_strides != 1) && (inputPlane != origInputPlane * m_plane_inflate_strides))) {
392 return Scalar(m_paddingValue);
395 const int depth_index =
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor) ? 0 : NumDims - 1;
396 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
398 const Index inputIndex = depth +
399 origInputRow * m_rowInputStride +
400 origInputCol * m_colInputStride +
401 origInputPlane * m_planeInputStride +
402 otherIndex * m_otherInputStride;
404 return m_impl.coeff(inputIndex);
407 template<
int LoadMode>
408 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index)
const
410 EIGEN_STATIC_ASSERT((PacketSize > 1), YOU_MADE_A_PROGRAMMING_MISTAKE)
411 eigen_assert(index+PacketSize-1 < dimensions().TotalSize());
413 if (m_in_row_strides != 1 || m_in_col_strides != 1 || m_row_inflate_strides != 1 || m_col_inflate_strides != 1 ||
414 m_in_plane_strides != 1 || m_plane_inflate_strides != 1) {
415 return packetWithPossibleZero(index);
418 const Index indices[2] = {index, index + PacketSize - 1};
419 const Index patchIndex = indices[0] / m_fastPatchStride;
420 if (patchIndex != indices[1] / m_fastPatchStride) {
421 return packetWithPossibleZero(index);
423 const Index otherIndex = (NumDims == 5) ? 0 : indices[0] / m_fastOtherStride;
424 eigen_assert(otherIndex == indices[1] / m_fastOtherStride);
427 const Index patchOffsets[2] = {(indices[0] - patchIndex * m_patchStride) / m_fastOutputDepth,
428 (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth};
430 const Index patch3DIndex = (NumDims == 5) ? patchIndex : (indices[0] - otherIndex * m_otherStride) / m_fastPatchStride;
431 eigen_assert(patch3DIndex == (indices[1] - otherIndex * m_otherStride) / m_fastPatchStride);
433 const Index colIndex = patch3DIndex / m_fastOutputPlanesRows;
434 const Index colOffsets[2] = {
435 patchOffsets[0] / m_fastColStride,
436 patchOffsets[1] / m_fastColStride};
439 const Index inputCols[2] = {
440 colIndex * m_col_strides + colOffsets[0] - m_colPaddingLeft,
441 colIndex * m_col_strides + colOffsets[1] - m_colPaddingLeft};
442 if (inputCols[1] < 0 || inputCols[0] >= m_inputCols) {
443 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
446 if (inputCols[0] != inputCols[1]) {
447 return packetWithPossibleZero(index);
450 const Index rowIndex = (patch3DIndex - colIndex * m_outputPlanesRows) / m_fastOutputPlanes;
451 const Index rowOffsets[2] = {
452 (patchOffsets[0] - colOffsets[0] * m_colStride) / m_fastRowStride,
453 (patchOffsets[1] - colOffsets[1] * m_colStride) / m_fastRowStride};
454 eigen_assert(rowOffsets[0] <= rowOffsets[1]);
456 const Index inputRows[2] = {
457 rowIndex * m_row_strides + rowOffsets[0] - m_rowPaddingTop,
458 rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop};
460 if (inputRows[1] < 0 || inputRows[0] >= m_inputRows) {
461 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
464 if (inputRows[0] != inputRows[1]) {
465 return packetWithPossibleZero(index);
468 const Index planeIndex = (patch3DIndex - m_outputPlanes * (colIndex * m_outputRows + rowIndex));
469 const Index planeOffsets[2] = {
470 patchOffsets[0] - colOffsets[0] * m_colStride - rowOffsets[0] * m_rowStride,
471 patchOffsets[1] - colOffsets[1] * m_colStride - rowOffsets[1] * m_rowStride};
472 eigen_assert(planeOffsets[0] <= planeOffsets[1]);
473 const Index inputPlanes[2] = {
474 planeIndex * m_plane_strides + planeOffsets[0] - m_planePaddingTop,
475 planeIndex * m_plane_strides + planeOffsets[1] - m_planePaddingTop};
477 if (inputPlanes[1] < 0 || inputPlanes[0] >= m_inputPlanes) {
478 return internal::pset1<PacketReturnType>(Scalar(m_paddingValue));
481 if (inputPlanes[0] >= 0 && inputPlanes[1] < m_inputPlanes) {
483 const int depth_index =
static_cast<int>(Layout) ==
static_cast<int>(
ColMajor) ? 0 : NumDims - 1;
484 const Index depth = index - (index / m_fastOutputDepth) * m_dimensions[depth_index];
485 const Index inputIndex = depth +
486 inputRows[0] * m_rowInputStride +
487 inputCols[0] * m_colInputStride +
488 m_planeInputStride * inputPlanes[0] +
489 otherIndex * m_otherInputStride;
490 return m_impl.template packet<Unaligned>(inputIndex);
493 return packetWithPossibleZero(index);
496 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost
497 costPerCoeff(
bool vectorized)
const {
498 const double compute_cost =
499 10 * TensorOpCost::DivCost<Index>() + 21 * TensorOpCost::MulCost<Index>() +
500 8 * TensorOpCost::AddCost<Index>();
501 return TensorOpCost(0, 0, compute_cost, vectorized, PacketSize);
504 EIGEN_DEVICE_FUNC Scalar* data()
const {
return NULL; }
506 const TensorEvaluator<ArgType, Device>& impl()
const {
return m_impl; }
508 Index planePaddingTop()
const {
return m_planePaddingTop; }
509 Index rowPaddingTop()
const {
return m_rowPaddingTop; }
510 Index colPaddingLeft()
const {
return m_colPaddingLeft; }
511 Index outputPlanes()
const {
return m_outputPlanes; }
512 Index outputRows()
const {
return m_outputRows; }
513 Index outputCols()
const {
return m_outputCols; }
514 Index userPlaneStride()
const {
return m_plane_strides; }
515 Index userRowStride()
const {
return m_row_strides; }
516 Index userColStride()
const {
return m_col_strides; }
517 Index userInPlaneStride()
const {
return m_in_plane_strides; }
518 Index userInRowStride()
const {
return m_in_row_strides; }
519 Index userInColStride()
const {
return m_in_col_strides; }
520 Index planeInflateStride()
const {
return m_plane_inflate_strides; }
521 Index rowInflateStride()
const {
return m_row_inflate_strides; }
522 Index colInflateStride()
const {
return m_col_inflate_strides; }
525 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index)
const
527 EIGEN_ALIGN_MAX
typename internal::remove_const<CoeffReturnType>::type values[PacketSize];
528 for (
int i = 0; i < PacketSize; ++i) {
529 values[i] = coeff(index+i);
531 PacketReturnType rslt = internal::pload<PacketReturnType>(values);
535 Dimensions m_dimensions;
538 Index m_plane_strides;
542 Index m_outputPlanes;
546 Index m_planePaddingTop;
547 Index m_rowPaddingTop;
548 Index m_colPaddingLeft;
550 Index m_in_plane_strides;
551 Index m_in_row_strides;
552 Index m_in_col_strides;
554 Index m_plane_inflate_strides;
555 Index m_row_inflate_strides;
556 Index m_col_inflate_strides;
565 Index m_outputPlanesRows;
568 Index m_input_planes_eff;
569 Index m_input_rows_eff;
570 Index m_input_cols_eff;
571 Index m_patch_planes_eff;
572 Index m_patch_rows_eff;
573 Index m_patch_cols_eff;
582 Index m_planeInputStride;
583 Index m_rowInputStride;
584 Index m_colInputStride;
585 Index m_otherInputStride;
587 internal::TensorIntDivisor<Index> m_fastOtherStride;
588 internal::TensorIntDivisor<Index> m_fastPatchStride;
589 internal::TensorIntDivisor<Index> m_fastColStride;
590 internal::TensorIntDivisor<Index> m_fastRowStride;
591 internal::TensorIntDivisor<Index> m_fastInputPlaneStride;
592 internal::TensorIntDivisor<Index> m_fastInputRowStride;
593 internal::TensorIntDivisor<Index> m_fastInputColStride;
594 internal::TensorIntDivisor<Index> m_fastInputColsEff;
595 internal::TensorIntDivisor<Index> m_fastOutputPlanesRows;
596 internal::TensorIntDivisor<Index> m_fastOutputPlanes;
597 internal::TensorIntDivisor<Index> m_fastOutputDepth;
599 Scalar m_paddingValue;
601 TensorEvaluator<ArgType, Device> m_impl;
The tensor base class.
Definition TensorForwardDeclarations.h:29
Patch extraction specialized for processing of volumetric data. This assumes that the input has a lea...
Definition TensorVolumePatch.h:53
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