1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 // This is essentially unsupported/CXX11/Eigen/Tensor.h
17 // TODO(petewarden) - move this to a common location in Eigen itself.
18 
19 // clang-format off
20 
21 
22 #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
23 #define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
24 
25 
26 #include "Eigen/Core"
27 
28 #if defined(EIGEN_USE_SYCL)
29 #undef min
30 #undef max
31 #undef isnan
32 #undef isinf
33 #undef isfinite
34 #include <CL/sycl.hpp>
35 #include <iostream>
36 #include <map>
37 #include <memory>
38 #include <utility>
39 #endif
40 #include <cmath>
41 #include <cstddef>
42 #include <cstring>
43 
44 
45 
46 
47 
48 #ifdef _WIN32
49 typedef __int16 int16_t;
50 typedef unsigned __int16 uint16_t;
51 typedef __int32 int32_t;
52 typedef unsigned __int32 uint32_t;
53 typedef __int64 int64_t;
54 typedef unsigned __int64 uint64_t;
55 #include <windows.h>
56 #else
57 #include <stdint.h>
58 #include <unistd.h>
59 #endif
60 
61 #if __cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900
62 #include <random>
63 #endif
64 
65 #ifdef _WIN32
66 #include <windows.h>
67 #elif defined(__APPLE__)
68 #include <mach/mach_time.h>
69 #else
70 #include <time.h>
71 #endif
72 
73 #ifdef EIGEN_USE_THREADS
74 #include "unsupported/Eigen/CXX11/ThreadPool"
75 #endif
76 
77 
78 #include "Eigen/src/Core/util/DisableStupidWarnings.h"
79 
80 #include "unsupported/Eigen/SpecialFunctions"
81 #include "unsupported/Eigen/CXX11/src/util/CXX11Meta.h"
82 #include "unsupported/Eigen/CXX11/src/util/MaxSizeVector.h"
83 
84 
85 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h"
86 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h"
87 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
88 
89 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h"
90 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
91 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h"
92 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h"
93 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h"
94 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h"
95 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h"
96 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h"
97 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h"
98 #include "unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h"
99 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h"
100 #include "unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h"
101 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h"
102 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h"
103 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBase.h"
104 // #include "unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h"
105 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h"
106 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h"
107 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h"
108 // #include "unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h"
109 #include "unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h"
110 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h"
111 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h"
112 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h"
113 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h"
114 
115 #undef TENSOR_CONTRACTION_DISPATCH
116 #define TENSOR_CONTRACTION_DISPATCH(METHOD, ALIGNMENT, ARGS)    \
117   if (this->m_lhs_inner_dim_contiguous &&                       \
118       this->m_rhs_inner_dim_contiguous &&                       \
119       !this->m_rhs_inner_dim_reordered) {                       \
120     METHOD<true, true, false, ALIGNMENT> ARGS;                  \
121   } else {                                                      \
122     eigen_assert(false && "Unsupported contraction formats");   \
123   }
124 
125 
126 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h"
127 // #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h"
128 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h"
129 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h"
130 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h"
131 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h"
132 #include "unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h"
133 #include "unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h"
134 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h"
135 #include "unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h"
136 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h"
137 #include "unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h"
138 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h"
139 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h"
140 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h"
141 #include "unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h"
142 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h"
143 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h"
144 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h"
145 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h"
146 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h"
147 #include "unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h"
148 #include "unsupported/Eigen/CXX11/src/Tensor/TensorScan.h"
149 // #include "unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h"
150 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
151 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h"
152 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h"
153 #include "unsupported/Eigen/CXX11/src/Tensor/Tensor.h"
154 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h"
155 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMap.h"
156 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRef.h"
157 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIO.h"
158 
159 #include "Eigen/src/Core/util/ReenableStupidWarnings.h"
160 
161 
162 #endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
163