Home | History | Annotate | Download | only in kernels
      1 /* Copyright 2016 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 // See docs in ../ops/array_ops.cc
     17 
     18 #if GOOGLE_CUDA
     19 
     20 #define EIGEN_USE_GPU
     21 
     22 #include "tensorflow/core/framework/register_types.h"
     23 #include "tensorflow/core/framework/types.h"
     24 #include "tensorflow/core/kernels/one_hot_op.h"
     25 
     26 namespace tensorflow {
     27 
     28 typedef Eigen::GpuDevice GPUDevice;
     29 
     30 #define DEFINE_GPU_SPEC_INDEX(T, TI)             \
     31   template class generator::OneGenerator<T, TI>; \
     32   template struct functor::OneHot<GPUDevice, T, TI>;
     33 
     34 #define DEFINE_GPU_SPEC(T)         \
     35   DEFINE_GPU_SPEC_INDEX(T, uint8); \
     36   DEFINE_GPU_SPEC_INDEX(T, int32); \
     37   DEFINE_GPU_SPEC_INDEX(T, int64)
     38 
     39 TF_CALL_GPU_NUMBER_TYPES(DEFINE_GPU_SPEC);
     40 TF_CALL_int32(DEFINE_GPU_SPEC);
     41 TF_CALL_int64(DEFINE_GPU_SPEC);
     42 
     43 #undef DEFINE_GPU_SPEC_INDEX
     44 #undef DEFINE_GPU_SPEC
     45 
     46 }  // end namespace tensorflow
     47 
     48 #endif  // GOOGLE_CUDA
     49