10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_MORPHING_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_MORPHING_H
25 template<
typename NewDimensions,
typename XprType>
26 struct traits<TensorReshapingOp<NewDimensions, XprType> > :
public traits<XprType>
28 typedef typename XprType::Scalar Scalar;
30 typedef typename XprTraits::StorageKind StorageKind;
31 typedef typename XprTraits::Index
Index;
32 typedef typename XprType::Nested Nested;
33 typedef std::remove_reference_t<Nested> Nested_;
34 static constexpr
int NumDimensions = array_size<NewDimensions>::value;
35 static constexpr
int Layout = XprTraits::Layout;
36 typedef typename XprTraits::PointerType PointerType;
39 template<
typename NewDimensions,
typename XprType>
40 struct eval<TensorReshapingOp<NewDimensions, XprType>,
Eigen::Dense>
42 typedef const TensorReshapingOp<NewDimensions, XprType>
EIGEN_DEVICE_REF type;
45 template<
typename NewDimensions,
typename XprType>
46 struct nested<TensorReshapingOp<NewDimensions, XprType>, 1, typename eval<TensorReshapingOp<NewDimensions, XprType> >::type>
48 typedef TensorReshapingOp<NewDimensions, XprType> type;
55 template<
typename NewDimensions,
typename XprType>
60 typedef typename Eigen::internal::traits<TensorReshapingOp>::Scalar
Scalar;
62 typedef typename Eigen::internal::nested<TensorReshapingOp>::type
Nested;
63 typedef typename Eigen::internal::traits<TensorReshapingOp>::StorageKind
StorageKind;
64 typedef typename Eigen::internal::traits<TensorReshapingOp>::Index
Index;
85 template<
typename NewDimensions,
typename ArgType,
typename Device>
99 static constexpr
int NumOutputDims = internal::array_size<Dimensions>::value;
100 static constexpr
int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
112 (NumOutputDims == 2 && internal::index_statically_eq<NewDimensions>(0, 1)) ? OneByN
113 : (NumOutputDims == 2 && internal::index_statically_eq<NewDimensions>(1, 1)) ? NByOne
125 NumInputDims > 0 && NumOutputDims > 0,
126 PreferBlockAccess =
false,
138 typename internal::TensorMaterializedBlock<
ScalarNoConst, NumOutputDims,
144 : m_impl(op.expression(), device), m_dimensions(op.
dimensions())
153 #ifdef EIGEN_USE_THREADS
154 template <
typename EvalSubExprsCallback>
155 EIGEN_STRONG_INLINE
void evalSubExprsIfNeededAsync(
157 m_impl.evalSubExprsIfNeededAsync(
data, std::move(done));
162 return m_impl.evalSubExprsIfNeeded(
data);
170 return m_impl.coeff(index);
173 template<
int LoadMode>
176 return m_impl.template packet<LoadMode>(index);
180 return m_impl.costPerCoeff(vectorized);
185 return internal::TensorBlockResourceRequirements::any();
190 struct BlockIteratorState {
199 bool =
false)
const {
202 (kind == OneByN && desc.dimensions()[0] == 1) ||
203 (kind == NByOne && desc.dimensions()[1] == 1));
205 if (kind == OneByN || kind == NByOne) {
209 m_impl.data() + desc.offset(), desc.dimensions());
213 return TensorBlock::materialize(m_impl.data(), m_dimensions, desc,
231 template<
typename NewDimensions,
typename ArgType,
typename Device>
233 :
public TensorEvaluator<const TensorReshapingOp<NewDimensions, ArgType>, Device>
245 PreferBlockAccess =
false,
260 typedef internal::TensorBlockDescriptor<TensorEvaluator::NumOutputDims, Index>
266 return this->m_impl.coeffRef(index);
272 this->m_impl.template writePacket<StoreMode>(index,
x);
275 template <
typename TensorBlock>
281 typedef internal::TensorBlockAssignment<
282 Scalar, TensorEvaluator::NumOutputDims, TensorBlockExpr,
Index>
285 TensorBlockAssign::Run(
286 TensorBlockAssign::target(desc.dimensions(),
287 internal::strides<Layout>(this->dimensions()),
288 this->m_impl.data(), desc.offset()),
302 template<
typename StartIndices,
typename Sizes,
typename XprType>
303 struct traits<TensorSlicingOp<StartIndices, Sizes, XprType> > :
public traits<XprType>
305 typedef typename XprType::Scalar Scalar;
307 typedef typename XprTraits::StorageKind StorageKind;
308 typedef typename XprTraits::Index
Index;
309 typedef typename XprType::Nested Nested;
310 typedef std::remove_reference_t<Nested> Nested_;
311 static constexpr
int NumDimensions = array_size<StartIndices>::value;
312 static constexpr
int Layout = XprTraits::Layout;
313 typedef typename XprTraits::PointerType PointerType;
316 template<
typename StartIndices,
typename Sizes,
typename XprType>
317 struct eval<TensorSlicingOp<StartIndices, Sizes, XprType>,
Eigen::Dense>
319 typedef const TensorSlicingOp<StartIndices, Sizes, XprType>
EIGEN_DEVICE_REF type;
322 template<
typename StartIndices,
typename Sizes,
typename XprType>
323 struct nested<TensorSlicingOp<StartIndices, Sizes, XprType>, 1, typename eval<TensorSlicingOp<StartIndices, Sizes, XprType> >::type>
325 typedef TensorSlicingOp<StartIndices, Sizes, XprType> type;
332 template<
typename StartIndices,
typename Sizes,
typename XprType>
337 typedef typename Eigen::internal::traits<TensorSlicingOp>::Scalar
Scalar;
339 typedef typename Eigen::internal::nested<TensorSlicingOp>::type
Nested;
340 typedef typename Eigen::internal::traits<TensorSlicingOp>::StorageKind
StorageKind;
341 typedef typename Eigen::internal::traits<TensorSlicingOp>::Index
Index;
367 template <
typename Index,
typename Device,
bool BlockAccess>
struct MemcpyTriggerForSlicing {
368 EIGEN_DEVICE_FUNC MemcpyTriggerForSlicing(
const Device& device) : threshold_(2 * device.numThreads()) { }
370 const bool prefer_block_evaluation = BlockAccess && total > 32*1024;
371 return !prefer_block_evaluation && contiguous > threshold_;
381 template <
typename Index,
bool BlockAccess>
struct MemcpyTriggerForSlicing<
Index, GpuDevice, BlockAccess> {
389 #ifdef EIGEN_USE_SYCL
390 template <
typename Index,
bool BlockAccess>
struct MemcpyTriggerForSlicing<
Index,
Eigen::SyclDevice, BlockAccess> {
399 template<
typename StartIndices,
typename Sizes,
typename ArgType,
typename Device>
403 static constexpr
int NumDims = internal::array_size<Sizes>::value;
422 !internal::is_same<std::remove_const_t<Scalar>,
bool>::value,
423 PreferBlockAccess =
true,
440 : m_impl(op.expression(), device),
m_device(device), m_dimensions(op.sizes()), m_offsets(op.startIndices())
442 m_is_identity =
true;
443 for (
int i = 0; i < internal::array_size<Dimensions>::value; ++
i) {
446 if (m_impl.dimensions()[
i] != op.
sizes()[
i] ||
448 m_is_identity =
false;
453 if (NumDims == 0)
return;
458 m_inputStrides[0] = 1;
459 for (
int i = 1;
i < NumDims; ++
i) {
460 m_inputStrides[
i] = m_inputStrides[
i-1] * input_dims[
i-1];
464 m_outputStrides[0] = 1;
465 for (
int i = 1;
i < NumDims; ++
i) {
466 m_outputStrides[
i] = m_outputStrides[
i-1] * output_dims[
i-1];
467 m_fastOutputStrides[
i] = internal::TensorIntDivisor<Index>(m_outputStrides[
i] > 0 ? m_outputStrides[
i] : 1);
470 m_inputStrides[NumDims-1] = 1;
471 for (
int i = NumDims - 2;
i >= 0; --
i) {
472 m_inputStrides[
i] = m_inputStrides[
i+1] * input_dims[
i+1];
476 m_outputStrides[NumDims-1] = 1;
477 for (
int i = NumDims - 2;
i >= 0; --
i) {
478 m_outputStrides[
i] = m_outputStrides[
i+1] * output_dims[
i+1];
479 m_fastOutputStrides[
i] = internal::TensorIntDivisor<Index>(m_outputStrides[
i] > 0 ? m_outputStrides[
i] : 1);
487 m_impl.evalSubExprsIfNeeded(NULL);
488 if (!
NumTraits<std::remove_const_t<Scalar>>::RequireInitialization
489 &&
data && m_impl.data()) {
490 Index contiguous_values = 1;
492 for (
int i = 0;
i < NumDims; ++
i) {
499 for (
int i = NumDims-1;
i >= 0; --
i) {
507 const internal::MemcpyTriggerForSlicing<Index, Device, BlockAccess> trigger(
m_device);
511 Index offset = srcCoeff(
i);
520 #ifdef EIGEN_USE_THREADS
521 template <
typename EvalSubExprsCallback>
522 EIGEN_STRONG_INLINE
void evalSubExprsIfNeededAsync(
524 m_impl.evalSubExprsIfNeededAsync(
nullptr, [done](
bool) { done(
true); });
535 return m_impl.coeff(index);
537 return m_impl.coeff(srcCoeff(index));
541 template<
int LoadMode>
549 return m_impl.template packet<LoadMode>(index);
552 Index inputIndices[] = {0, 0};
553 Index indices[] = {index, index + packetSize - 1};
556 for (
int i = NumDims - 1;
i > 0; --
i) {
557 const Index idx0 = indices[0] / m_fastOutputStrides[
i];
558 const Index idx1 = indices[1] / m_fastOutputStrides[
i];
559 inputIndices[0] += (idx0 + m_offsets[
i]) * m_inputStrides[
i];
560 inputIndices[1] += (idx1 + m_offsets[
i]) * m_inputStrides[
i];
561 indices[0] -= idx0 * m_outputStrides[
i];
562 indices[1] -= idx1 * m_outputStrides[
i];
564 inputIndices[0] += (indices[0] + m_offsets[0]);
565 inputIndices[1] += (indices[1] + m_offsets[0]);
568 for (
int i = 0;
i < NumDims - 1; ++
i) {
569 const Index idx0 = indices[0] / m_fastOutputStrides[
i];
570 const Index idx1 = indices[1] / m_fastOutputStrides[
i];
571 inputIndices[0] += (idx0 + m_offsets[
i]) * m_inputStrides[
i];
572 inputIndices[1] += (idx1 + m_offsets[
i]) * m_inputStrides[
i];
573 indices[0] -= idx0 * m_outputStrides[
i];
574 indices[1] -= idx1 * m_outputStrides[
i];
576 inputIndices[0] += (indices[0] + m_offsets[NumDims-1]);
577 inputIndices[1] += (indices[1] + m_offsets[NumDims-1]);
579 if (inputIndices[1] - inputIndices[0] == packetSize - 1) {
584 EIGEN_ALIGN_MAX std::remove_const_t<CoeffReturnType> values[packetSize];
585 values[0] = m_impl.coeff(inputIndices[0]);
586 values[packetSize-1] = m_impl.coeff(inputIndices[1]);
588 for (
int i = 1;
i < packetSize-1; ++
i) {
597 return m_impl.costPerCoeff(vectorized) +
TensorOpCost(0, 0, m_is_identity ? 1 : NumDims);
602 const size_t target_size =
m_device.lastLevelCacheSize();
603 return internal::TensorBlockResourceRequirements::merge(
604 internal::TensorBlockResourceRequirements::skewed<Scalar>(target_size),
605 m_impl.getResourceRequirements());
610 bool =
false)
const {
613 if (!arg_desc.HasDestinationBuffer()) desc.DropDestinationBuffer();
622 for (
int i = 0;
i < NumDims; ++
i) {
623 if (m_dimensions[
i] != m_impl.dimensions()[
i]) {
624 offset += m_offsets[
i] * m_inputStrides[
i];
625 for (
int j =
i+1;
j < NumDims; ++
j) {
626 if (m_dimensions[
j] > 1) {
629 offset += m_offsets[
j] * m_inputStrides[
j];
635 for (
int i = NumDims - 1;
i >= 0; --
i) {
636 if (m_dimensions[
i] != m_impl.dimensions()[
i]) {
637 offset += m_offsets[
i] * m_inputStrides[
i];
638 for (
int j =
i-1;
j >= 0; --
j) {
639 if (m_dimensions[
j] > 1) {
642 offset += m_offsets[
j] * m_inputStrides[
j];
648 return result + offset;
656 Index inputIndex = 0;
659 for (
int i = NumDims - 1;
i > 0; --
i) {
660 const Index idx = index / m_fastOutputStrides[
i];
661 inputIndex += (idx + m_offsets[
i]) * m_inputStrides[
i];
662 index -= idx * m_outputStrides[
i];
664 inputIndex += (index + m_offsets[0]);
667 for (
int i = 0;
i < NumDims - 1; ++
i) {
668 const Index idx = index / m_fastOutputStrides[
i];
669 inputIndex += (idx + m_offsets[
i]) * m_inputStrides[
i];
670 index -= idx * m_outputStrides[
i];
672 inputIndex += (index + m_offsets[NumDims-1]);
689 template<
typename StartIndices,
typename Sizes,
typename ArgType,
typename Device>
691 :
public TensorEvaluator<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Device>
695 static constexpr
int NumDims = internal::array_size<Sizes>::value;
708 PreferBlockAccess =
true,
726 if (this->m_is_identity) {
727 return this->m_impl.coeffRef(index);
729 return this->m_impl.coeffRef(this->srcCoeff(index));
736 if (this->m_is_identity) {
737 this->m_impl.template writePacket<StoreMode>(index,
x);
742 Index inputIndices[] = {0, 0};
743 Index indices[] = {index, index + packetSize - 1};
746 for (
int i = NumDims - 1;
i > 0; --
i) {
747 const Index idx0 = indices[0] / this->m_fastOutputStrides[
i];
748 const Index idx1 = indices[1] / this->m_fastOutputStrides[
i];
749 inputIndices[0] += (idx0 + this->m_offsets[
i]) * this->m_inputStrides[
i];
750 inputIndices[1] += (idx1 + this->m_offsets[
i]) * this->m_inputStrides[
i];
751 indices[0] -= idx0 * this->m_outputStrides[
i];
752 indices[1] -= idx1 * this->m_outputStrides[
i];
754 inputIndices[0] += (indices[0] + this->m_offsets[0]);
755 inputIndices[1] += (indices[1] + this->m_offsets[0]);
758 for (
int i = 0;
i < NumDims - 1; ++
i) {
759 const Index idx0 = indices[0] / this->m_fastOutputStrides[
i];
760 const Index idx1 = indices[1] / this->m_fastOutputStrides[
i];
761 inputIndices[0] += (idx0 + this->m_offsets[
i]) * this->m_inputStrides[
i];
762 inputIndices[1] += (idx1 + this->m_offsets[
i]) * this->m_inputStrides[
i];
763 indices[0] -= idx0 * this->m_outputStrides[
i];
764 indices[1] -= idx1 * this->m_outputStrides[
i];
766 inputIndices[0] += (indices[0] + this->m_offsets[NumDims-1]);
767 inputIndices[1] += (indices[1] + this->m_offsets[NumDims-1]);
769 if (inputIndices[1] - inputIndices[0] == packetSize - 1) {
770 this->m_impl.template writePacket<StoreMode>(inputIndices[0],
x);
774 internal::pstore<CoeffReturnType, PacketReturnType>(values,
x);
775 this->m_impl.coeffRef(inputIndices[0]) = values[0];
776 this->m_impl.coeffRef(inputIndices[1]) = values[packetSize-1];
778 for (
int i = 1;
i < packetSize-1; ++
i) {
784 template<
typename TensorBlock>
787 TensorBlockDesc arg_desc = desc.WithOffset(this->srcCoeff(desc.offset()));
788 this->m_impl.writeBlock(arg_desc,
block);
793 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename XprType>
794 struct traits<TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType> > :
public traits<XprType>
796 typedef typename XprType::Scalar Scalar;
798 typedef typename XprTraits::StorageKind StorageKind;
799 typedef typename XprTraits::Index
Index;
800 typedef typename XprType::Nested Nested;
801 typedef std::remove_reference_t<Nested> Nested_;
802 static constexpr
int NumDimensions = array_size<StartIndices>::value;
803 static constexpr
int Layout = XprTraits::Layout;
804 typedef typename XprTraits::PointerType PointerType;
807 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename XprType>
808 struct eval<TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType>,
Eigen::Dense>
810 typedef const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType>
EIGEN_DEVICE_REF type;
813 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename XprType>
814 struct nested<TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType>, 1, typename eval<TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType> >::type>
816 typedef TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprType> type;
822 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename XprType>
827 typedef typename internal::traits<TensorStridingSlicingOp>::Scalar
Scalar;
829 typedef typename internal::nested<TensorStridingSlicingOp>::type
Nested;
830 typedef typename internal::traits<TensorStridingSlicingOp>::StorageKind
StorageKind;
831 typedef typename internal::traits<TensorStridingSlicingOp>::Index
Index;
860 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename ArgType,
typename Device>
864 static constexpr
int NumDims = internal::array_size<Strides>::value;
889 : m_impl(op.expression(), device),
895 for (ptrdiff_t
i = 0; i < internal::array_size<Dimensions>::value; ++
i) {
897 if (m_strides[
i] > 0) {
898 startIndicesClamped[
i] =
900 stopIndicesClamped[
i] =
904 startIndicesClamped[
i] =
906 stopIndicesClamped[
i] =
909 m_startIndices[
i] = startIndicesClamped[
i];
913 const InputDimensions& input_dims = m_impl.
dimensions();
916 m_is_identity =
true;
917 for (
int i = 0;
i < NumDims;
i++) {
918 Index interval = stopIndicesClamped[
i] - startIndicesClamped[
i];
919 if (interval == 0 || ((interval < 0) != (m_strides[
i] < 0))) {
923 (interval / m_strides[
i]) + (interval % m_strides[
i] != 0 ? 1 : 0);
926 if (m_strides[
i] != 1 || interval != m_impl.dimensions()[
i]) {
927 m_is_identity =
false;
931 Strides output_dims = m_dimensions;
934 m_inputStrides[0] = m_strides[0];
935 m_offsets[0] = startIndicesClamped[0];
936 Index previousDimProduct = 1;
937 for (
int i = 1;
i < NumDims; ++
i) {
938 previousDimProduct *= input_dims[
i-1];
939 m_inputStrides[
i] = previousDimProduct * m_strides[
i];
940 m_offsets[
i] = startIndicesClamped[
i] * previousDimProduct;
944 m_outputStrides[0] = 1;
945 for (
int i = 1;
i < NumDims; ++
i) {
946 m_outputStrides[
i] = m_outputStrides[
i-1] * output_dims[
i-1];
947 m_fastOutputStrides[
i] = internal::TensorIntDivisor<Index>(m_outputStrides[
i] > 0 ? m_outputStrides[
i] : 1);
950 m_inputStrides[NumDims-1] = m_strides[NumDims-1];
951 m_offsets[NumDims-1] = startIndicesClamped[NumDims-1];
952 Index previousDimProduct = 1;
953 for (
int i = NumDims - 2;
i >= 0; --
i) {
954 previousDimProduct *= input_dims[
i+1];
955 m_inputStrides[
i] = previousDimProduct * m_strides[
i];
956 m_offsets[
i] = startIndicesClamped[
i] * previousDimProduct;
959 m_outputStrides[NumDims-1] = 1;
960 for (
int i = NumDims - 2;
i >= 0; --
i) {
961 m_outputStrides[
i] = m_outputStrides[
i+1] * output_dims[
i+1];
962 m_fastOutputStrides[
i] = internal::TensorIntDivisor<Index>(m_outputStrides[
i] > 0 ? m_outputStrides[
i] : 1);
971 m_impl.evalSubExprsIfNeeded(NULL);
982 return m_impl.coeff(index);
984 return m_impl.coeff(srcCoeff(index));
989 return m_impl.costPerCoeff(vectorized) +
TensorOpCost(0, 0, m_is_identity ? 1 : NumDims);
999 Index inputIndex = 0;
1002 for (
int i = NumDims - 1;
i >= 0; --
i) {
1003 const Index idx = index / m_fastOutputStrides[
i];
1004 inputIndex += idx * m_inputStrides[
i] + m_offsets[
i];
1005 index -= idx * m_outputStrides[
i];
1009 for (
int i = 0;
i < NumDims; ++
i) {
1010 const Index idx = index / m_fastOutputStrides[
i];
1011 inputIndex += idx * m_inputStrides[
i] + m_offsets[
i];
1012 index -= idx * m_outputStrides[
i];
1019 #ifndef SYCL_DEVICE_ONLY
1022 return cl::sycl::clamp(value,
min,
max);
1039 template<
typename StartIndices,
typename StopIndices,
typename Str
ides,
typename ArgType,
typename Device>
1041 :
public TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType>, Device>
1045 static constexpr
int NumDims = internal::array_size<Strides>::value;
1051 BlockAccess =
false,
1073 if (this->m_is_identity) {
1074 return this->m_impl.coeffRef(index);
1076 return this->m_impl.coeffRef(this->srcCoeff(index));
#define EIGEN_UNROLL_LOOP
#define EIGEN_DEVICE_FUNC
#define EIGEN_STATIC_ASSERT(X, MSG)
#define EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived)
A tensor expression mapping an existing array of data.
TensorReshapingOp(const XprType &expr, const NewDimensions &dims)
const NewDimensions & dimensions() const
Eigen::internal::nested< TensorReshapingOp >::type Nested
Eigen::internal::traits< TensorReshapingOp >::Scalar Scalar
const internal::remove_all_t< typename XprType::Nested > & expression() const
TensorBase< TensorReshapingOp< NewDimensions, XprType >, WriteAccessors > Base
const NewDimensions m_dims
std::remove_const_t< typename XprType::CoeffReturnType > CoeffReturnType
Eigen::internal::traits< TensorReshapingOp >::StorageKind StorageKind
Eigen::internal::traits< TensorReshapingOp >::Index Index
XprType::CoeffReturnType CoeffReturnType
TensorBase< TensorSlicingOp< StartIndices, Sizes, XprType > > Base
const Sizes & sizes() const
const internal::remove_all_t< typename XprType::Nested > & expression() const
Eigen::internal::traits< TensorSlicingOp >::Scalar Scalar
Eigen::internal::traits< TensorSlicingOp >::Index Index
Eigen::internal::traits< TensorSlicingOp >::StorageKind StorageKind
const StartIndices m_indices
TensorSlicingOp(const XprType &expr, const StartIndices &indices, const Sizes &sizes)
Eigen::internal::nested< TensorSlicingOp >::type Nested
const StartIndices & startIndices() const
internal::traits< TensorStridingSlicingOp >::Scalar Scalar
internal::traits< TensorStridingSlicingOp >::Index Index
const internal::remove_all_t< typename XprType::Nested > & expression() const
const StartIndices & stopIndices() const
internal::traits< TensorStridingSlicingOp >::StorageKind StorageKind
const StartIndices & startIndices() const
const StartIndices & strides() const
const StartIndices m_startIndices
internal::nested< TensorStridingSlicingOp >::type Nested
XprType::CoeffReturnType CoeffReturnType
TensorBase< TensorStridingSlicingOp< StartIndices, StopIndices, Strides, XprType > > Base
TensorStridingSlicingOp(const XprType &expr, const StartIndices &startIndices, const StopIndices &stopIndices, const Strides &strides)
const StopIndices m_stopIndices
typename remove_all< T >::type remove_all_t
EIGEN_ALWAYS_INLINE DSizes< IndexType, NumDims > strides(const DSizes< IndexType, NumDims > &dimensions)
constexpr auto array_prod(const array< T, N > &arr) -> decltype(array_reduce< product_op, T, N >(arr, static_cast< T >(1)))
EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
T * constCast(const T *data)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
CleanedUpDerType< DerType >::type() min(const AutoDiffScalar< DerType > &x, const T &y)
CleanedUpDerType< DerType >::type() max(const AutoDiffScalar< DerType > &x, const T &y)
internal::packet_traits< Scalar >::type type
CoeffReturnType & coeffRef(Index index) const
TensorEvaluator(const XprType &op, const Device &device)
void writeBlock(const TensorBlockDesc &desc, const TensorBlock &block)
TensorEvaluator< const TensorReshapingOp< NewDimensions, ArgType >, Device > Base
TensorReshapingOp< NewDimensions, ArgType > XprType
XprType::CoeffReturnType CoeffReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
internal::TensorBlockDescriptor< TensorEvaluator::NumOutputDims, Index > TensorBlockDesc
void writePacket(Index index, const PacketReturnType &x) const
XprType::CoeffReturnType CoeffReturnType
void writePacket(Index index, const PacketReturnType &x) const
TensorEvaluator(const XprType &op, const Device &device)
void writeBlock(const TensorBlockDesc &desc, const TensorBlock &block)
TensorSlicingOp< StartIndices, Sizes, ArgType > XprType
TensorEvaluator< const TensorSlicingOp< StartIndices, Sizes, ArgType >, Device > Base
CoeffReturnType & coeffRef(Index index) const
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
PacketType< CoeffReturnType, Device >::type PacketReturnType
std::remove_const_t< Scalar > ScalarNoConst
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
internal::TensorBlockNotImplemented TensorBlock
XprType::CoeffReturnType CoeffReturnType
TensorEvaluator(const XprType &op, const Device &device)
CoeffReturnType & coeffRef(Index index) const
TensorStridingSlicingOp< StartIndices, StopIndices, Strides, ArgType > XprType
TensorEvaluator< const TensorStridingSlicingOp< StartIndices, StopIndices, Strides, ArgType >, Device > Base
PacketType< CoeffReturnType, Device >::type PacketReturnType
TensorReshapingOp< NewDimensions, ArgType > XprType
CoeffReturnType coeff(Index index) const
StorageMemory< std::remove_const_t< CoeffReturnType >, Device > ConstCastStorage
PacketReturnType packet(Index index) const
NewDimensions m_dimensions
Storage::Type EvaluatorPointerType
Storage::Type data() const
TensorOpCost costPerCoeff(bool vectorized) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
TensorEvaluator< ArgType, Device > m_impl
TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
StorageMemory< CoeffReturnType, Device > Storage
internal::TensorBlockDescriptor< NumOutputDims, Index > TensorBlockDesc
const TensorEvaluator< ArgType, Device > & impl() const
internal::TensorMaterializedBlock< ScalarNoConst, NumOutputDims, Layout, Index > TensorBlock
const Dimensions & dimensions() const
TensorEvaluator(const XprType &op, const Device &device)
bool evalSubExprsIfNeeded(EvaluatorPointerType data)
std::remove_const_t< Scalar > ScalarNoConst
internal::TensorBlockResourceRequirements getResourceRequirements() const
XprType::CoeffReturnType CoeffReturnType
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
TensorEvaluator< ArgType, Device > m_impl
TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
internal::TensorBlockResourceRequirements getResourceRequirements() const
bool evalSubExprsIfNeeded(EvaluatorPointerType data)
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
array< Index, NumDims > m_outputStrides
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
const Device EIGEN_DEVICE_REF m_device
Index srcCoeff(Index index) const
StorageMemory< CoeffReturnType, Device > Storage
StorageMemory< std::remove_const_t< CoeffReturnType >, Device > ConstCastStorage
TensorOpCost costPerCoeff(bool vectorized) const
Storage::Type data() const
const Dimensions & dimensions() const
CoeffReturnType coeff(Index index) const
std::remove_const_t< Scalar > ScalarNoConst
TensorEvaluator(const XprType &op, const Device &device)
TensorEvaluator< const ArgType, Device >::TensorBlock TensorBlock
XprType::CoeffReturnType CoeffReturnType
PacketReturnType packet(Index index) const
array< Index, NumDims > m_inputStrides
PacketType< CoeffReturnType, Device >::type PacketReturnType
const StartIndices m_offsets
TensorSlicingOp< StartIndices, Sizes, ArgType > XprType
Storage::Type EvaluatorPointerType
array< internal::TensorIntDivisor< Index >, NumDims > m_fastOutputStrides
TensorOpCost costPerCoeff(bool vectorized) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
array< internal::TensorIntDivisor< Index >, NumDims > m_fastOutputStrides
Index srcCoeff(Index index) const
TensorEvaluator< ArgType, Device > m_impl
XprType::CoeffReturnType CoeffReturnType
StorageMemory< CoeffReturnType, Device > Storage
bool evalSubExprsIfNeeded(EvaluatorPointerType)
CoeffReturnType coeff(Index index) const
TensorStridingSlicingOp< StartIndices, StopIndices, Strides, ArgType > XprType
array< Index, NumDims > m_outputStrides
const Dimensions & dimensions() const
const Device EIGEN_DEVICE_REF m_device
TensorEvaluator(const XprType &op, const Device &device)
Storage::Type data() const
internal::TensorBlockNotImplemented TensorBlock
DSizes< Index, NumDims > m_dimensions
static Index clamp(Index value, Index min, Index max)
Storage::Type EvaluatorPointerType
DSizes< Index, NumDims > m_startIndices
array< Index, NumDims > m_inputStrides
DSizes< Index, NumDims > m_offsets
A cost model used to limit the number of threads used for evaluating tensor expression.
const Dimensions & dimensions() const
static constexpr int Layout
const Device EIGEN_DEVICE_REF m_device
TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
CoeffReturnType coeff(Index index) const
Storage::Type EvaluatorPointerType
CoeffReturnType & coeffRef(Index index) const
EvaluatorPointerType data() const
internal::TensorMaterializedBlock< ScalarNoConst, NumCoords, Layout, Index > TensorBlock
std::remove_const_t< Scalar > ScalarNoConst