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 #ifndef TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_ 16 #define TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_ 17 18 #define EIGEN_USE_CUSTOM_THREAD_POOL 19 #define EIGEN_USE_THREADS 20 21 // clang-format off 22 23 #include <stdint.h> 24 25 #include <cstddef> 26 #include <cstring> 27 #include <cmath> 28 #include <random> 29 #include <atomic> 30 #include <condition_variable> // NOLINT(build/c++11) 31 #include <mutex> // NOLINT(build/c++11) 32 #include <thread> // NOLINT(build/c++11) 33 #include <functional> 34 35 #ifdef _WIN32 36 #include <windows.h> 37 #elif defined(__APPLE__) 38 #include <mach/mach_time.h> 39 #else 40 #include <time.h> 41 #endif 42 43 44 // Because some programs may link Eigen in through other frameworks with 45 // different flags, we can run into multiple definition issues if we don't have 46 // a private namespace for our versions. This is a nasty hack, but a similar 47 // approach is used elsewhere to handle the problem, so it should be stable. 48 #define Eigen EigenForTFLite 49 50 #include "Eigen/src/Core/util/StaticAssert.h" 51 #include "unsupported/Eigen/CXX11/Core" 52 #include "unsupported/Eigen/SpecialFunctions" 53 54 #include "Eigen/src/Core/util/DisableStupidWarnings.h" 55 56 #include "Eigen/Core" 57 58 // Beware: the order of the include matters to some compilers. For example 59 // TensorIndexList.h should be included before TensorDimensions.h in order to 60 // use index lists to encode tensor dimensions when compiling with llvm. 61 // We're defining this ourselves rather than using the Eigen Tensor header file 62 // so that we can alter the macro definition of TENSOR_CONTRACTION_DISPATCH to 63 // reduce binary size. 64 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h" 65 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h" 66 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h" 67 #include "unsupported/Eigen/CXX11/src/Tensor/ThreadPoolInterface.h" 68 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceType.h" 69 #include "unsupported/Eigen/CXX11/src/Tensor/TensorNonBlockingThreadPool.h" 70 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h" 71 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h" 72 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h" 73 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h" 74 #include "unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h" 75 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h" 76 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h" 77 #include "unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h" 78 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h" 79 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h" 80 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h" 81 82 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStats.h" 83 84 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBase.h" 85 86 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h" 87 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h" 88 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h" 89 #include "unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h" 90 91 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h" 92 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionMappers.h" 93 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h" 94 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h" 95 #undef TENSOR_CONTRACTION_DISPATCH 96 #define TENSOR_CONTRACTION_DISPATCH(METHOD, ALIGNMENT, ARGS) \ 97 if (this->m_lhs_inner_dim_contiguous && \ 98 this->m_rhs_inner_dim_contiguous && \ 99 !this->m_rhs_inner_dim_reordered) { \ 100 METHOD<true, true, false, ALIGNMENT> ARGS; \ 101 } else { \ 102 eigen_assert(false && "Unsupported contraction formats"); \ 103 } 104 105 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h" 106 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h" 107 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h" 108 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h" 109 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h" 110 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h" 111 #include "unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h" 112 #include "unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h" 113 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h" 114 #include "unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h" 115 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h" 116 #include "unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h" 117 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h" 118 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h" 119 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h" 120 #include "unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h" 121 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h" 122 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h" 123 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h" 124 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h" 125 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h" 126 #include "unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h" 127 #include "unsupported/Eigen/CXX11/src/Tensor/TensorScan.h" 128 129 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h" 130 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h" 131 132 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h" 133 #include "unsupported/Eigen/CXX11/src/Tensor/Tensor.h" 134 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h" 135 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMap.h" 136 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRef.h" 137 138 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h" 139 140 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIO.h" 141 142 #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 143 #endif // TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_ 144