Eigen-unsupported  5.0.1-dev+284dcc12
 
Loading...
Searching...
No Matches
TensorForwardDeclarations.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
11#define EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
18// MakePointer class is used as a container of the address space of the pointer
19// on the host and on the device. From the host side it generates the T* pointer
20// and when EIGEN_USE_SYCL is used it construct a buffer with a map_allocator to
21// T* m_data on the host. It is always called on the device.
22// Specialisation of MakePointer class for creating the sycl buffer with
23// map_allocator.
24template <typename T>
25struct MakePointer {
26 typedef T* Type;
27 typedef const T* ConstType;
28};
29
30template <typename T>
31EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* constCast(const T* data) {
32 return const_cast<T*>(data);
33}
34
35// The StorageMemory class is a container of the device specific pointer
36// used for referring to a Pointer on TensorEvaluator class. While the TensorExpression
37// is a device-agnostic type and need MakePointer class for type conversion,
38// the TensorEvaluator class can be specialized for a device, hence it is possible
39// to construct different types of temporary storage memory in TensorEvaluator
40// for different devices by specializing the following StorageMemory class.
41template <typename T, typename device>
42struct StorageMemory : MakePointer<T> {};
43
44namespace internal {
45template <typename A, typename B>
46struct Pointer_type_promotion {
47 static const bool val = false;
48};
49template <typename A>
50struct Pointer_type_promotion<A, A> {
51 static const bool val = true;
52};
53template <typename A, typename B>
54struct TypeConversion {
55 typedef A* type;
56};
57} // namespace internal
58
59template <typename PlainObjectType, int Options_ = Unaligned, template <class> class MakePointer_ = MakePointer>
60class TensorMap;
61template <typename Scalar_, int NumIndices_, int Options_ = 0, typename IndexType = DenseIndex>
62class Tensor;
63template <typename Scalar_, typename Dimensions, int Options_ = 0, typename IndexType = DenseIndex>
64class TensorFixedSize;
65template <typename PlainObjectType>
66class TensorRef;
67template <typename Derived, int AccessLevel>
69
70template <typename NullaryOp, typename PlainObjectType>
72template <typename UnaryOp, typename XprType>
74template <typename BinaryOp, typename LeftXprType, typename RightXprType>
76template <typename TernaryOp, typename Arg1XprType, typename Arg2XprType, typename Arg3XprType>
77class TensorCwiseTernaryOp;
78template <typename IfXprType, typename ThenXprType, typename ElseXprType>
79class TensorSelectOp;
80template <typename Op, typename Dims, typename XprType, template <class> class MakePointer_ = MakePointer>
82template <typename XprType>
84template <typename ReduceOp, typename Dims, typename XprType>
85class TensorPairReducerOp;
86template <typename Axis, typename LeftXprType, typename RightXprType>
88template <typename Dimensions, typename LeftXprType, typename RightXprType, typename OutputKernelType>
90template <typename TargetType, typename XprType>
92template <typename Dimensions, typename InputXprType, typename KernelXprType>
94template <typename FFT, typename XprType, int FFTDataType, int FFTDirection>
95class TensorFFTOp;
96template <typename PatchDim, typename XprType>
97class TensorPatchOp;
98template <DenseIndex Rows, DenseIndex Cols, typename XprType>
100template <DenseIndex Planes, DenseIndex Rows, DenseIndex Cols, typename XprType>
102template <typename Broadcast, typename XprType>
104template <DenseIndex DimId, typename XprType>
105class TensorChippingOp;
106template <typename NewDimensions, typename XprType>
108template <typename XprType>
109class TensorLayoutSwapOp;
110template <typename StartIndices, typename Sizes, typename XprType>
111class TensorSlicingOp;
112template <typename ReverseDimensions, typename XprType>
113class TensorReverseOp;
114template <typename Rolls, typename XprType>
115class TensorRollOp;
116template <typename PaddingDimensions, typename XprType>
117class TensorPaddingOp;
118template <typename Shuffle, typename XprType>
120template <typename Strides, typename XprType>
121class TensorStridingOp;
122template <typename StartIndices, typename StopIndices, typename Strides, typename XprType>
123class TensorStridingSlicingOp;
124template <typename Strides, typename XprType>
126template <typename Generator, typename XprType>
128template <typename LeftXprType, typename RightXprType>
129class TensorAssignOp;
130template <typename Op, typename XprType>
131class TensorScanOp;
132template <typename Dims, typename XprType>
133class TensorTraceOp;
134
135template <typename CustomUnaryFunc, typename XprType>
137template <typename CustomBinaryFunc, typename LhsXprType, typename RhsXprType>
139
140template <typename XprType, template <class> class MakePointer_ = MakePointer>
141class TensorEvalToOp;
142template <typename XprType>
144
145template <typename ExpressionType, typename DeviceType>
146class TensorDevice;
147template <typename ExpressionType, typename DeviceType, typename DoneCallback>
149template <typename Derived, typename Device>
150struct TensorEvaluator;
151
152struct NoOpOutputKernel;
153
154struct DefaultDevice;
155struct ThreadPoolDevice;
156struct GpuDevice;
157struct SyclDevice;
158
159#ifdef EIGEN_USE_SYCL
160namespace TensorSycl {
161namespace internal {
162template <typename Evaluator, typename Op>
163class GenericNondeterministicReducer;
164}
165} // namespace TensorSycl
166#endif
167
168enum FFTResultType { RealPart = 0, ImagPart = 1, BothParts = 2 };
169
170enum FFTDirection { FFT_FORWARD = 0, FFT_REVERSE = 1 };
171
172namespace internal {
173
174template <typename Device, typename Expression>
175struct IsVectorizable {
176 static const bool value = TensorEvaluator<Expression, Device>::PacketAccess;
177};
178
179template <typename Expression>
180struct IsVectorizable<GpuDevice, Expression> {
181 static const bool value =
182 TensorEvaluator<Expression, GpuDevice>::PacketAccess && TensorEvaluator<Expression, GpuDevice>::IsAligned;
183};
184
185// Tiled evaluation strategy.
186enum TiledEvaluation {
187 Off = 0, // tiled evaluation is not supported
188 On = 1, // still work in progress (see TensorBlock.h)
189};
190
191template <typename Device, typename Expression>
192struct IsTileable {
193 // Check that block evaluation is supported and it's a preferred option (at
194 // least one sub-expression has much faster block evaluation, e.g.
195 // broadcasting).
196 static constexpr bool BlockAccess =
197 TensorEvaluator<Expression, Device>::BlockAccess && TensorEvaluator<Expression, Device>::PreferBlockAccess;
198
199 static const TiledEvaluation value = BlockAccess ? TiledEvaluation::On : TiledEvaluation::Off;
200};
201
202template <typename Expression, typename Device, bool Vectorizable = IsVectorizable<Device, Expression>::value,
203 TiledEvaluation Tiling = IsTileable<Device, Expression>::value>
204class TensorExecutor;
205
206template <typename Expression, typename Device, typename DoneCallback,
207 bool Vectorizable = IsVectorizable<Device, Expression>::value,
208 TiledEvaluation Tiling = IsTileable<Device, Expression>::value>
210
211} // end namespace internal
212
213} // end namespace Eigen
214
215#endif // EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
Definition TensorAssign.h:55
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition TensorDevice.h:87
The tensor base class.
Definition TensorForwardDeclarations.h:68
Definition TensorBroadcasting.h:66
Definition TensorChipping.h:65
Tensor concatenation class.
Definition TensorConcatenation.h:58
Definition TensorContraction.h:303
Tensor conversion class. This class makes it possible to vectorize type casting operations when the n...
Definition TensorConversion.h:166
Definition TensorConvolution.h:232
Tensor custom class.
Definition TensorCustomOp.h:193
Tensor custom class.
Definition TensorCustomOp.h:49
Tensor binary expression.
Definition TensorExpr.h:171
Tensor nullary expression.
Definition TensorExpr.h:42
Tensor unary expression.
Definition TensorExpr.h:98
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition TensorDevice.h:30
Tensor FFT class.
Definition TensorFFT.h:101
The fixed sized version of the tensor class.
Definition TensorFixedSize.h:29
Tensor reshaping class.
Definition TensorForcedEval.h:55
Tensor generator class.
Definition TensorGenerator.h:50
Patch extraction specialized for image processing. This assumes that the input has a least 3 dimensio...
Definition TensorImagePatch.h:117
Tensor + Index Pair class.
Definition TensorArgMax.h:50
Tensor inflation class.
Definition TensorInflation.h:50
A tensor expression mapping an existing array of data.
Definition TensorMap.h:33
Tensor padding class. At the moment only padding with a constant value is supported.
Definition TensorPadding.h:53
Tensor patch class.
Definition TensorPatch.h:50
Tensor reduction class.
Definition TensorReduction.h:501
A reference to a tensor expression The expression will be evaluated lazily (as much as possible).
Definition TensorRef.h:241
Tensor reshaping class.
Definition TensorMorphing.h:51
Tensor reverse elements class.
Definition TensorReverse.h:52
Tensor roll (circular shift) elements class.
Definition TensorRoll.h:50
Tensor scan class.
Definition TensorScan.h:49
Tensor shuffling class.
Definition TensorShuffling.h:50
Tensor striding class.
Definition TensorStriding.h:50
Tensor Trace class.
Definition TensorTrace.h:54
Patch extraction specialized for processing of volumetric data. This assumes that the input has a lea...
Definition TensorVolumePatch.h:56
The tensor class.
Definition Tensor.h:68
Definition TensorExecutor.h:108
The tensor executor class.
Definition TensorExecutor.h:76
Namespace containing all symbols from the Eigen library.
The tensor evaluator class.
Definition TensorEvaluator.h:30