TensorShuffling.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_SHUFFLING_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_SHUFFLING_H
12 
13 namespace Eigen {
14 
22 namespace internal {
23 template<typename Shuffle, typename XprType>
24 struct traits<TensorShufflingOp<Shuffle, XprType> > : public traits<XprType>
25 {
26  typedef typename XprType::Scalar Scalar;
28  typedef typename XprTraits::StorageKind StorageKind;
29  typedef typename XprTraits::Index Index;
30  typedef typename XprType::Nested Nested;
32  static const int NumDimensions = XprTraits::NumDimensions;
33  static const int Layout = XprTraits::Layout;
34  typedef typename XprTraits::PointerType PointerType;
35 };
36 
37 template<typename Shuffle, typename XprType>
39 {
41 };
42 
43 template<typename Shuffle, typename XprType>
44 struct nested<TensorShufflingOp<Shuffle, XprType>, 1, typename eval<TensorShufflingOp<Shuffle, XprType> >::type>
45 {
47 };
48 
49 } // end namespace internal
50 
51 
52 
53 template<typename Shuffle, typename XprType>
54 class TensorShufflingOp : public TensorBase<TensorShufflingOp<Shuffle, XprType> >
55 {
56  public:
60  typedef typename XprType::CoeffReturnType CoeffReturnType;
64 
66  : m_xpr(expr), m_shuffle(shfl) {}
67 
69  const Shuffle& shufflePermutation() const { return m_shuffle; }
70 
73  expression() const { return m_xpr; }
74 
76 
77 
78  protected:
79  typename XprType::Nested m_xpr;
80  const Shuffle m_shuffle;
81 };
82 
83 
84 // Eval as rvalue
85 template<typename Shuffle, typename ArgType, typename Device>
86 struct TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device>
87 {
90  typedef typename XprType::Index Index;
93  typedef typename XprType::Scalar Scalar;
99 
100  enum {
101  IsAligned = false,
106  CoordAccess = false, // to be implemented
107  RawAccess = false
108  };
109 
111 
112  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
115 
116  typedef typename internal::TensorMaterializedBlock<ScalarNoConst, NumDims,
117  Layout, Index>
119  //===--------------------------------------------------------------------===//
120 
121  EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
122  : m_device(device),
123  m_impl(op.expression(), device)
124  {
125  const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions();
126  const Shuffle& shuffle = op.shufflePermutation();
127  m_is_identity = true;
128  for (int i = 0; i < NumDims; ++i) {
129  m_shuffle[i] = static_cast<int>(shuffle[i]);
130  m_dimensions[i] = input_dims[shuffle[i]];
131  m_inverseShuffle[shuffle[i]] = i;
132  if (m_is_identity && shuffle[i] != i) {
133  m_is_identity = false;
134  }
135  }
136 
137  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
138  m_unshuffledInputStrides[0] = 1;
139  m_outputStrides[0] = 1;
140 
141  for (int i = 1; i < NumDims; ++i) {
142  m_unshuffledInputStrides[i] =
143  m_unshuffledInputStrides[i - 1] * input_dims[i - 1];
144  m_outputStrides[i] = m_outputStrides[i - 1] * m_dimensions[i - 1];
145  m_fastOutputStrides[i] = internal::TensorIntDivisor<Index>(
146  m_outputStrides[i] > 0 ? m_outputStrides[i] : Index(1));
147  }
148  } else {
149  m_unshuffledInputStrides[NumDims - 1] = 1;
150  m_outputStrides[NumDims - 1] = 1;
151  for (int i = NumDims - 2; i >= 0; --i) {
152  m_unshuffledInputStrides[i] =
153  m_unshuffledInputStrides[i + 1] * input_dims[i + 1];
154  m_outputStrides[i] = m_outputStrides[i + 1] * m_dimensions[i + 1];
155  m_fastOutputStrides[i] = internal::TensorIntDivisor<Index>(
156  m_outputStrides[i] > 0 ? m_outputStrides[i] : Index(1));
157  }
158  }
159 
160  for (int i = 0; i < NumDims; ++i) {
161  m_inputStrides[i] = m_unshuffledInputStrides[shuffle[i]];
162  }
163  }
164 
165  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
166 
168  m_impl.evalSubExprsIfNeeded(NULL);
169  return true;
170  }
171 
172 #ifdef EIGEN_USE_THREADS
173  template <typename EvalSubExprsCallback>
174  EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(
175  EvaluatorPointerType, EvalSubExprsCallback done) {
176  m_impl.evalSubExprsIfNeededAsync(nullptr, [done](bool) { done(true); });
177  }
178 #endif // EIGEN_USE_THREADS
179 
181  m_impl.cleanup();
182  }
183 
185  {
186  if (m_is_identity) {
187  return m_impl.coeff(index);
188  } else {
189  return m_impl.coeff(srcCoeff(index));
190  }
191  }
192 
193  template <int LoadMode, typename Self, bool ImplPacketAccess>
194  struct PacketLoader {
196  static PacketReturnType Run(const Self& self, Index index) {
199  for (int i = 0; i < PacketSize; ++i) {
200  values[i] = self.coeff(index + i);
201  }
202  PacketReturnType rslt = internal::pload<PacketReturnType>(values);
203  return rslt;
204  }
205  };
206 
207  template<int LoadMode, typename Self>
208  struct PacketLoader<LoadMode, Self, true> {
210  static PacketReturnType Run(const Self& self, Index index) {
211  if (self.m_is_identity) {
212  return self.m_impl.template packet<LoadMode>(index);
213  } else {
216  for (int i = 0; i < PacketSize; ++i) {
217  values[i] = self.coeff(index + i);
218  }
219  PacketReturnType rslt = internal::pload<PacketReturnType>(values);
220  return rslt;
221  }
222  }
223  };
224 
225  template<int LoadMode>
227  {
228  EIGEN_STATIC_ASSERT((PacketSize > 1), YOU_MADE_A_PROGRAMMING_MISTAKE)
229  eigen_assert(index + PacketSize - 1 < dimensions().TotalSize());
230  return PacketLoader<LoadMode, Self, TensorEvaluator<ArgType, Device>::PacketAccess>::Run(*this, index);
231  }
232 
235  static const int inner_dim =
236  Layout == static_cast<int>(ColMajor) ? 0 : NumDims - 1;
237 
238  const size_t target_size = m_device.firstLevelCacheSize();
239  const bool inner_dim_shuffled = m_shuffle[inner_dim] != inner_dim;
240 
241  // Shuffled inner dimensions leads to a random memory access, which is not
242  // captured by default cost model bytes loaded/stored. We add this cost
243  // explicitly. The number of cycles picked based on the benchmarks.
244  // TODO(ezhulenev): This number was picked based on a very questionable
245  // benchmarks, add benchmarks that are representative of real workloads.
246  using BlockRequirements = internal::TensorBlockResourceRequirements;
247  if (inner_dim_shuffled) {
248  return BlockRequirements::uniform<Scalar>(target_size)
249  .addCostPerCoeff({0, 0, NumDims * 28});
250  } else {
251  return BlockRequirements::skewed<Scalar>(target_size);
252  }
253  }
254 
257  bool root_of_expr_ast = false) const {
258  assert(m_impl.data() != NULL);
259 
261  TensorBlockIO;
262  typedef typename TensorBlockIO::Dst TensorBlockIODst;
263  typedef typename TensorBlockIO::Src TensorBlockIOSrc;
264 
265  const typename TensorBlock::Storage block_storage =
267  desc, scratch, /*allow_strided_storage=*/root_of_expr_ast);
268 
269  typename TensorBlockIO::Dimensions input_strides(m_unshuffledInputStrides);
270  TensorBlockIOSrc src(input_strides, m_impl.data(), srcCoeff(desc.offset()));
271 
272  TensorBlockIODst dst(block_storage.dimensions(), block_storage.strides(),
273  block_storage.data());
274 
275  typename TensorBlockIO::DimensionsMap dst_to_src_dim_map(m_shuffle);
276  TensorBlockIO::Copy(dst, src, dst_to_src_dim_map);
277 
278  return block_storage.AsTensorMaterializedBlock();
279  }
280 
282  const double compute_cost = m_is_identity ? TensorOpCost::AddCost<Index>() :
283  NumDims * (2 * TensorOpCost::AddCost<Index>() +
284  2 * TensorOpCost::MulCost<Index>() +
285  TensorOpCost::DivCost<Index>());
286  return m_impl.costPerCoeff(vectorized) +
287  TensorOpCost(0, 0, compute_cost, m_is_identity /* vectorized */, PacketSize);
288  }
289 
290  EIGEN_DEVICE_FUNC typename Storage::Type data() const { return NULL; }
291 
292 #ifdef EIGEN_USE_SYCL
293  // binding placeholder accessors to a command group handler for SYCL
294  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void bind(cl::sycl::handler &cgh) const {
295  m_impl.bind(cgh);
296  }
297 #endif
298  protected:
300  Index input_index,
301  const DSizes<Index, NumDims>& input_block_strides,
302  const DSizes<Index, NumDims>& output_block_strides,
303  const DSizes<internal::TensorIntDivisor<Index>, NumDims>& fast_input_block_strides) const {
304  Index output_index = 0;
305  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
306  for (int i = NumDims - 1; i > 0; --i) {
307  const Index idx = input_index / fast_input_block_strides[i];
308  output_index += idx * output_block_strides[m_inverseShuffle[i]];
309  input_index -= idx * input_block_strides[i];
310  }
311  return output_index + input_index *
312  output_block_strides[m_inverseShuffle[0]];
313  } else {
314  for (int i = 0; i < NumDims - 1; ++i) {
315  const Index idx = input_index / fast_input_block_strides[i];
316  output_index += idx * output_block_strides[m_inverseShuffle[i]];
317  input_index -= idx * input_block_strides[i];
318  }
319  return output_index + input_index *
320  output_block_strides[m_inverseShuffle[NumDims - 1]];
321  }
322  }
323 
325  Index inputIndex = 0;
326  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
327  for (int i = NumDims - 1; i > 0; --i) {
328  const Index idx = index / m_fastOutputStrides[i];
329  inputIndex += idx * m_inputStrides[i];
330  index -= idx * m_outputStrides[i];
331  }
332  return inputIndex + index * m_inputStrides[0];
333  } else {
334  for (int i = 0; i < NumDims - 1; ++i) {
335  const Index idx = index / m_fastOutputStrides[i];
336  inputIndex += idx * m_inputStrides[i];
337  index -= idx * m_outputStrides[i];
338  }
339  return inputIndex + index * m_inputStrides[NumDims - 1];
340  }
341  }
342 
346  array<Index, NumDims> m_inverseShuffle; // TODO(ezhulenev): Make it int type.
351 
354 };
355 
356 
357 // Eval as lvalue
358 template<typename Shuffle, typename ArgType, typename Device>
359 struct TensorEvaluator<TensorShufflingOp<Shuffle, ArgType>, Device>
360  : public TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device>
361 {
363 
365  typedef typename XprType::Index Index;
368  typedef typename XprType::Scalar Scalar;
372 
373  enum {
374  IsAligned = false,
379  RawAccess = false
380  };
381 
383 
384  //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
386  //===--------------------------------------------------------------------===//
387 
388  EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
389  : Base(op, device)
390  { }
391 
393  {
394  return this->m_impl.coeffRef(this->srcCoeff(index));
395  }
396 
397  template <int StoreMode> EIGEN_STRONG_INLINE
398  void writePacket(Index index, const PacketReturnType& x)
399  {
400  EIGEN_STATIC_ASSERT((PacketSize > 1), YOU_MADE_A_PROGRAMMING_MISTAKE)
401 
403  internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
405  for (int i = 0; i < PacketSize; ++i) {
406  this->coeffRef(index+i) = values[i];
407  }
408  }
409 
410  template <typename TensorBlock>
412  const TensorBlockDesc& desc, const TensorBlock& block) {
413  eigen_assert(this->m_impl.data() != NULL);
414 
416  TensorBlockIO;
417  typedef typename TensorBlockIO::Dst TensorBlockIODst;
418  typedef typename TensorBlockIO::Src TensorBlockIOSrc;
419 
420  const Scalar* block_buffer = block.data();
421 
422  // TODO(ezhulenev): TensorBlockIO should be able to read from any Eigen
423  // expression with coefficient and packet access as `src`.
424  void* mem = NULL;
425  if (block_buffer == NULL) {
426  mem = this->m_device.allocate(desc.size() * sizeof(Scalar));
427  ScalarNoConst* buf = static_cast<ScalarNoConst*>(mem);
428 
430  ScalarNoConst, NumDims, typename TensorBlock::XprType, Index>
431  TensorBlockAssignment;
432 
433  TensorBlockAssignment::Run(
434  TensorBlockAssignment::target(
435  desc.dimensions(), internal::strides<Layout>(desc.dimensions()),
436  buf),
437  block.expr());
438 
439  block_buffer = buf;
440  }
441 
442  // Read from block.
443  TensorBlockIOSrc src(internal::strides<Layout>(desc.dimensions()),
444  block_buffer);
445 
446  // Write to the output buffer.
447  typename TensorBlockIO::Dimensions output_strides(
448  this->m_unshuffledInputStrides);
449  typename TensorBlockIO::Dimensions output_dimensions;
450  for (int i = 0; i < NumDims; ++i) {
451  output_dimensions[this->m_shuffle[i]] = desc.dimension(i);
452  }
453  TensorBlockIODst dst(output_dimensions, output_strides, this->m_impl.data(),
454  this->srcCoeff(desc.offset()));
455 
456  // Reorder dimensions according to the shuffle.
457  typename TensorBlockIO::DimensionsMap dst_to_src_dim_map;
458  for (int i = 0; i < NumDims; ++i) {
459  dst_to_src_dim_map[i] = static_cast<int>(this->m_inverseShuffle[i]);
460  }
461  TensorBlockIO::Copy(dst, src, dst_to_src_dim_map);
462 
463  // Deallocate temporary buffer used for the block materialization.
464  if (mem != NULL) this->m_device.deallocate(mem);
465  }
466 };
467 
468 
469 } // end namespace Eigen
470 
471 #endif // EIGEN_CXX11_TENSOR_TENSOR_SHUFFLING_H
Eigen::TensorEvaluator::dimensions
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
Definition: TensorEvaluator.h:73
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::data
EIGEN_DEVICE_FUNC Storage::Type data() const
Definition: TensorShuffling.h:290
Eigen::internal::TensorBlockScratchAllocator
Definition: TensorBlock.h:525
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::Index
XprType::Index Index
Definition: TensorShuffling.h:90
Eigen::internal::nested< TensorShufflingOp< Shuffle, XprType >, 1, typename eval< TensorShufflingOp< Shuffle, XprType > >::type >::type
TensorShufflingOp< Shuffle, XprType > type
Definition: TensorShuffling.h:46
Eigen::internal::TensorBlockDescriptor::size
IndexType size() const
Definition: TensorBlock.h:301
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::TensorBlock
internal::TensorMaterializedBlock< ScalarNoConst, NumDims, Layout, Index > TensorBlock
Definition: TensorShuffling.h:118
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::Self
TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device > Self
Definition: TensorShuffling.h:88
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_fastOutputStrides
array< internal::TensorIntDivisor< Index >, NumDims > m_fastOutputStrides
Definition: TensorShuffling.h:348
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::Dimensions
DSizes< Index, NumDims > Dimensions
Definition: TensorShuffling.h:92
Eigen::CwiseBinaryOp
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:77
Eigen::array< int, NumDims >
Eigen::TensorShufflingOp::Index
Eigen::internal::traits< TensorShufflingOp >::Index Index
Definition: TensorShuffling.h:63
Eigen::internal::nested
Definition: TensorTraits.h:174
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::EvaluatorPointerType
Storage::Type EvaluatorPointerType
Definition: TensorShuffling.h:98
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::PacketLoader::Run
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketReturnType Run(const Self &self, Index index)
Definition: TensorShuffling.h:196
eigen_assert
#define eigen_assert(x)
Definition: Macros.h:1037
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::writePacket
EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType &x)
Definition: TensorShuffling.h:398
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::writeBlock
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock(const TensorBlockDesc &desc, const TensorBlock &block)
Definition: TensorShuffling.h:411
pybind_wrapper_test_script.this
this
Definition: pybind_wrapper_test_script.py:38
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
Eigen::TensorEvaluator::TensorBlock
internal::TensorMaterializedBlock< ScalarNoConst, NumCoords, Layout, Index > TensorBlock
Definition: TensorEvaluator.h:63
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::CoeffReturnType
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:94
Eigen::TensorEvaluator::Index
Derived::Index Index
Definition: TensorEvaluator.h:30
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_is_identity
bool m_is_identity
Definition: TensorShuffling.h:344
Eigen::TensorEvaluator::Layout
@ Layout
Definition: TensorEvaluator.h:50
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::coeffRef
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index)
Definition: TensorShuffling.h:392
Eigen::TensorShufflingOp::Nested
Eigen::internal::nested< TensorShufflingOp >::type Nested
Definition: TensorShuffling.h:61
Eigen::internal::TensorMaterializedBlock
Definition: TensorBlock.h:656
Eigen::TensorShufflingOp::RealScalar
Eigen::NumTraits< Scalar >::Real RealScalar
Definition: TensorShuffling.h:59
Eigen::internal::TensorMaterializedBlock::Storage
Definition: TensorBlock.h:694
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::TensorEvaluator
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorShuffling.h:121
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::XprTraits
traits< XprType > XprTraits
Definition: TensorShuffling.h:27
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_inputStrides
array< Index, NumDims > m_inputStrides
Definition: TensorShuffling.h:349
Eigen::internal::TensorBlockDescriptor::dimensions
const Dimensions & dimensions() const
Definition: TensorBlock.h:299
Eigen::TensorEvaluator::PacketSize
static const int PacketSize
Definition: TensorEvaluator.h:36
Eigen::internal::TensorIntDivisor< Index >
Eigen::DSizes< Index, NumDims >
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::StorageKind
XprTraits::StorageKind StorageKind
Definition: TensorShuffling.h:28
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::cleanup
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorShuffling.h:180
EIGEN_ALIGN_MAX
#define EIGEN_ALIGN_MAX
Definition: ConfigureVectorization.h:157
Eigen::PacketType
Definition: TensorMeta.h:50
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::ScalarNoConst
internal::remove_const< Scalar >::type ScalarNoConst
Definition: TensorShuffling.h:110
Eigen::internal::TensorBlockDescriptor< NumDims, Index >
Eigen::internal::true_type
Definition: Meta.h:96
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::XprType
TensorShufflingOp< Shuffle, ArgType > XprType
Definition: TensorShuffling.h:89
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::getResourceRequirements
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorShuffling.h:234
Eigen::internal::TensorBlockIO
Definition: TensorBlock.h:17
Eigen::TensorShufflingOp::shufflePermutation
const EIGEN_DEVICE_FUNC Shuffle & shufflePermutation() const
Definition: TensorShuffling.h:69
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::dimensions
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
Definition: TensorShuffling.h:165
Eigen::TensorShufflingOp::TensorShufflingOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorShufflingOp(const XprType &expr, const Shuffle &shfl)
Definition: TensorShuffling.h:65
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::packet
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorShuffling.h:226
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::ScalarNoConst
internal::remove_const< Scalar >::type ScalarNoConst
Definition: TensorShuffling.h:382
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::TensorBlockDesc
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorShuffling.h:113
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::Index
XprTraits::Index Index
Definition: TensorShuffling.h:29
EIGEN_UNROLL_LOOP
#define EIGEN_UNROLL_LOOP
Definition: Macros.h:1461
Eigen::TensorEvaluator::PreferBlockAccess
@ PreferBlockAccess
Definition: TensorEvaluator.h:49
Eigen::TensorShufflingOp::StorageKind
Eigen::internal::traits< TensorShufflingOp >::StorageKind StorageKind
Definition: TensorShuffling.h:62
Eigen::TensorEvaluator::ScalarNoConst
internal::remove_const< Scalar >::type ScalarNoConst
Definition: TensorEvaluator.h:55
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::PacketLoader< LoadMode, Self, true >::Run
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE PacketReturnType Run(const Self &self, Index index)
Definition: TensorShuffling.h:210
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_unshuffledInputStrides
array< Index, NumDims > m_unshuffledInputStrides
Definition: TensorShuffling.h:350
Eigen::internal::TensorBlockDescriptor::offset
IndexType offset() const
Definition: TensorBlock.h:298
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::Index
XprType::Index Index
Definition: TensorShuffling.h:365
Eigen::TensorShufflingOp::expression
const EIGEN_DEVICE_FUNC internal::remove_all< typename XprType::Nested >::type & expression() const
Definition: TensorShuffling.h:73
Eigen::Triplet< double >
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::Dimensions
DSizes< Index, NumDims > Dimensions
Definition: TensorShuffling.h:367
Eigen::TensorShufflingOp::m_xpr
XprType::Nested m_xpr
Definition: TensorShuffling.h:79
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_dimensions
Dimensions m_dimensions
Definition: TensorShuffling.h:343
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::evalSubExprsIfNeeded
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorShuffling.h:167
Eigen::TensorEvaluator::m_device
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:192
Eigen::StorageMemory
Definition: TensorForwardDeclarations.h:37
Eigen::TensorBase
The tensor base class.
Definition: TensorBase.h:973
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::Scalar
XprType::Scalar Scalar
Definition: TensorShuffling.h:26
Eigen::internal::TensorMaterializedBlock::Storage::data
Scalar * data() const
Definition: TensorBlock.h:696
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::GetBlockOutputIndex
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index GetBlockOutputIndex(Index input_index, const DSizes< Index, NumDims > &input_block_strides, const DSizes< Index, NumDims > &output_block_strides, const DSizes< internal::TensorIntDivisor< Index >, NumDims > &fast_input_block_strides) const
Definition: TensorShuffling.h:299
Eigen::internal::TensorBlockResourceRequirements::addCostPerCoeff
EIGEN_DEVICE_FUNC TensorBlockResourceRequirements & addCostPerCoeff(TensorOpCost cost)
Definition: TensorBlock.h:145
Eigen::internal::array_size
Definition: Meta.h:445
Eigen::internal::eval< TensorShufflingOp< Shuffle, XprType >, Eigen::Dense >::type
const typedef TensorShufflingOp< Shuffle, XprType > & type
Definition: TensorShuffling.h:40
Eigen::TensorEvaluator::BlockAccess
@ BlockAccess
Definition: TensorEvaluator.h:48
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::_Nested
remove_reference< Nested >::type _Nested
Definition: TensorShuffling.h:31
Eigen::TensorEvaluator::coeffRef
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index)
Definition: TensorEvaluator.h:99
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >
Definition: TensorShuffling.h:86
EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS
#define EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Definition: TensorMacros.h:94
Eigen::internal::TensorBlockAssignment
Definition: TensorBlock.h:1381
Eigen::internal::TensorMaterializedBlock::XprType
TensorMap< const Tensor< Scalar, NumDims, Layout > > XprType
Definition: TensorBlock.h:659
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::srcCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index srcCoeff(Index index) const
Definition: TensorShuffling.h:324
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::TensorBlockScratch
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorShuffling.h:114
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_inverseShuffle
array< Index, NumDims > m_inverseShuffle
Definition: TensorShuffling.h:346
EIGEN_STATIC_ASSERT
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Eigen::TensorShufflingOp::CoeffReturnType
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:60
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_outputStrides
array< Index, NumDims > m_outputStrides
Definition: TensorShuffling.h:347
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::CoeffReturnType
XprType::CoeffReturnType CoeffReturnType
Definition: TensorShuffling.h:369
leaf::values
leaf::MyValues values
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::PointerType
XprTraits::PointerType PointerType
Definition: TensorShuffling.h:34
Eigen::TensorShufflingOp::Base
TensorBase< TensorShufflingOp< Shuffle, XprType > > Base
Definition: TensorShuffling.h:57
Eigen::TensorEvaluator::EvaluatorPointerType
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:39
Eigen::internal::traits< TensorShufflingOp< Shuffle, XprType > >::Nested
XprType::Nested Nested
Definition: TensorShuffling.h:30
Eigen::internal::TensorBlockResourceRequirements
Definition: TensorBlock.h:75
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::coeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorShuffling.h:184
Eigen::internal::TensorMaterializedBlock::data
const Scalar * data() const
Definition: TensorBlock.h:681
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::PacketReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorShuffling.h:370
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::costPerCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorShuffling.h:281
EIGEN_DEVICE_REF
#define EIGEN_DEVICE_REF
Definition: TensorMacros.h:50
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::TensorBlockDesc
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorShuffling.h:385
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_impl
TensorEvaluator< ArgType, Device > m_impl
Definition: TensorShuffling.h:353
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::TensorEvaluator
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorShuffling.h:388
Eigen::TensorEvaluator
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:28
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_device
const Device EIGEN_DEVICE_REF m_device
Definition: TensorShuffling.h:352
Eigen::internal::TensorMaterializedBlock::Storage::dimensions
const Dimensions & dimensions() const
Definition: TensorBlock.h:697
Eigen::internal::TensorMaterializedBlock::expr
const XprType & expr() const
Definition: TensorBlock.h:677
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::Storage
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorShuffling.h:97
Eigen::TensorShufflingOp
Definition: TensorForwardDeclarations.h:81
internal
Definition: BandTriangularSolver.h:13
Eigen::TensorShufflingOp::m_shuffle
const Shuffle m_shuffle
Definition: TensorShuffling.h:80
NULL
#define NULL
Definition: ccolamd.c:609
Eigen::internal::TensorMaterializedBlock::prepareStorage
static EIGEN_STRONG_INLINE Storage prepareStorage(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool allow_strided_storage=false)
Definition: TensorBlock.h:730
Eigen::ColMajor
@ ColMajor
Definition: Constants.h:319
Eigen::internal::TensorBlockDescriptor::dimension
IndexType dimension(int index) const
Definition: TensorBlock.h:300
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::Base
TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device > Base
Definition: TensorShuffling.h:362
Eigen::TensorEvaluator::IsAligned
@ IsAligned
Definition: TensorEvaluator.h:46
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::m_shuffle
array< int, NumDims > m_shuffle
Definition: TensorShuffling.h:345
Eigen::TensorEvaluator::block
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:158
Eigen::internal::TensorMaterializedBlock::Storage::strides
const Dimensions & strides() const
Definition: TensorBlock.h:698
Eigen::internal::eval
Definition: XprHelper.h:332
Eigen::TensorEvaluator::PacketAccess
@ PacketAccess
Definition: TensorEvaluator.h:47
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::PacketReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorShuffling.h:95
Eigen::internal::TensorMaterializedBlock::Storage::AsTensorMaterializedBlock
TensorMaterializedBlock AsTensorMaterializedBlock() const
Definition: TensorBlock.h:700
Eigen::TensorOpCost
Definition: TensorCostModel.h:25
test_callbacks.value
value
Definition: test_callbacks.py:158
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::Scalar
XprType::Scalar Scalar
Definition: TensorShuffling.h:93
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::Scalar
XprType::Scalar Scalar
Definition: TensorShuffling.h:368
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >::XprType
TensorShufflingOp< Shuffle, ArgType > XprType
Definition: TensorShuffling.h:364
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46
Eigen::TensorShufflingOp::Scalar
Eigen::internal::traits< TensorShufflingOp >::Scalar Scalar
Definition: TensorShuffling.h:58
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >::block
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool root_of_expr_ast=false) const
Definition: TensorShuffling.h:256
Eigen::Dense
Definition: Constants.h:507


gtsam
Author(s):
autogenerated on Sat Jun 1 2024 03:06:02