Home | History | Annotate | Download | only in optimized
      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_CONTRIB_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
     23 #define TENSORFLOW_CONTRIB_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 // #if defined(EIGEN_USE_LIBXSMM)
     74 // #include "libxsmm.h"
     75 // #endif
     76 
     77 #ifdef EIGEN_USE_THREADS
     78 #include "unsupported/Eigen/CXX11/ThreadPool"
     79 #endif
     80 
     81 
     82 #include "Eigen/src/Core/util/DisableStupidWarnings.h"
     83 
     84 #include "unsupported/Eigen/SpecialFunctions"
     85 #include "unsupported/Eigen/CXX11/src/util/CXX11Meta.h"
     86 #include "unsupported/Eigen/CXX11/src/util/MaxSizeVector.h"
     87 
     88 
     89 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h"
     90 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h"
     91 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
     92 
     93 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h"
     94 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
     95 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h"
     96 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h"
     97 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h"
     98 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h"
     99 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h"
    100 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h"
    101 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h"
    102 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h"
    103 #include "unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h"
    104 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h"
    105 #include "unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h"
    106 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h"
    107 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h"
    108 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBase.h"
    109 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h"
    110 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h"
    111 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h"
    112 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h"
    113 #include "unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h"
    114 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h"
    115 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h"
    116 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h"
    117 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h"
    118 
    119 #undef TENSOR_CONTRACTION_DISPATCH
    120 #define TENSOR_CONTRACTION_DISPATCH(METHOD, ALIGNMENT, ARGS)    \
    121   if (this->m_lhs_inner_dim_contiguous &&                       \
    122       this->m_rhs_inner_dim_contiguous &&                       \
    123       !this->m_rhs_inner_dim_reordered) {                       \
    124     METHOD<true, true, false, ALIGNMENT> ARGS;                  \
    125   } else {                                                      \
    126     eigen_assert(false && "Unsupported contraction formats");   \
    127   }
    128 
    129 
    130 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h"
    131 #include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h"
    132 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h"
    133 #include "unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h"
    134 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h"
    135 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h"
    136 #include "unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h"
    137 #include "unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h"
    138 #include "unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h"
    139 #include "unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h"
    140 #include "unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h"
    141 #include "unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h"
    142 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h"
    143 #include "unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h"
    144 #include "unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h"
    145 #include "unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h"
    146 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h"
    147 #include "unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h"
    148 #include "unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h"
    149 #include "unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h"
    150 #include "unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h"
    151 #include "unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h"
    152 #include "unsupported/Eigen/CXX11/src/Tensor/TensorScan.h"
    153 // No TensorTrace.h exsists in current Eigen project in Android.
    154 // TODO: uncomment once Eigen got updated.
    155 // #include "unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h"
    156 #include "unsupported/Eigen/CXX11/src/Tensor/TensorSycl.h"
    157 #include "unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
    158 #include "unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h"
    159 #include "unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h"
    160 #include "unsupported/Eigen/CXX11/src/Tensor/Tensor.h"
    161 #include "unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h"
    162 #include "unsupported/Eigen/CXX11/src/Tensor/TensorMap.h"
    163 #include "unsupported/Eigen/CXX11/src/Tensor/TensorRef.h"
    164 #include "unsupported/Eigen/CXX11/src/Tensor/TensorIO.h"
    165 
    166 #include "Eigen/src/Core/util/ReenableStupidWarnings.h"
    167 
    168 
    169 #endif  // TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
    170