• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2015 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 #if GOOGLE_CUDA
17 
18 #include "tensorflow/core/kernels/gather_functor.h"
19 #include "tensorflow/core/framework/register_types.h"
20 
21 namespace tensorflow {
22 
23 typedef Eigen::GpuDevice GPUDevice;
24 
25 namespace functor {
26 
27 // Forward declarations of the functor specializations for GPU.
28 #define DECLARE_GPU_SPECS_INDEX(T, Index)                               \
29   template <>                                                           \
30   int64 GatherFunctor<GPUDevice, T, Index>::operator()(                 \
31       OpKernelContext* ctx, typename TTypes<T, 3>::ConstTensor Tparams, \
32       typename TTypes<Index>::ConstFlat Tindices,                       \
33       typename TTypes<T, 3>::Tensor Tout);                              \
34   extern template struct GatherFunctor<GPUDevice, T, Index>;
35 
36 #define DECLARE_GPU_SPECS(T)         \
37   DECLARE_GPU_SPECS_INDEX(T, int32); \
38   DECLARE_GPU_SPECS_INDEX(T, int64)
39 
40 TF_CALL_int64(DECLARE_GPU_SPECS);
41 TF_CALL_GPU_NUMBER_TYPES(DECLARE_GPU_SPECS);
42 TF_CALL_complex64(DECLARE_GPU_SPECS);
43 TF_CALL_complex128(DECLARE_GPU_SPECS);
44 
45 #undef DECLARE_GPU_SPECS
46 #undef DECLARE_GPU_SPECS_INDEX
47 
48 }  // namespace functor
49 }  // namespace tensorflow
50 
51 #else
52 
53 #include "tensorflow/core/kernels/gather_functor.h"
54 
55 #endif  // GOOGLE_CUDA
56