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 | #include "tensorflow/core/kernels/reduction_ops_common.h" |
17 | |
18 | namespace tensorflow { |
19 | |
20 | #define REGISTER_CPU_KERNELS(type) \ |
21 | REGISTER_KERNEL_BUILDER(Name("Prod") \ |
22 | .Device(DEVICE_CPU) \ |
23 | .TypeConstraint<type>("T") \ |
24 | .TypeConstraint<int32>("Tidx"), \ |
25 | ReductionOp<CPUDevice, type, int32, \ |
26 | Eigen::internal::ProdReducer<type>>); \ |
27 | REGISTER_KERNEL_BUILDER(Name("Prod") \ |
28 | .Device(DEVICE_CPU) \ |
29 | .TypeConstraint<type>("T") \ |
30 | .TypeConstraint<int64_t>("Tidx"), \ |
31 | ReductionOp<CPUDevice, type, int64, \ |
32 | Eigen::internal::ProdReducer<type>>); |
33 | TF_CALL_NUMBER_TYPES(REGISTER_CPU_KERNELS); |
34 | #undef REGISTER_CPU_KERNELS |
35 | |
36 | #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM |
37 | |
38 | #define REGISTER_GPU_KERNELS(type) \ |
39 | REGISTER_KERNEL_BUILDER(Name("Prod") \ |
40 | .Device(DEVICE_GPU) \ |
41 | .TypeConstraint<type>("T") \ |
42 | .TypeConstraint<int32>("Tidx") \ |
43 | .HostMemory("reduction_indices"), \ |
44 | ReductionOp<GPUDevice, type, int32, \ |
45 | Eigen::internal::ProdReducer<type>>); \ |
46 | REGISTER_KERNEL_BUILDER(Name("Prod") \ |
47 | .Device(DEVICE_GPU) \ |
48 | .TypeConstraint<type>("T") \ |
49 | .TypeConstraint<int64_t>("Tidx") \ |
50 | .HostMemory("reduction_indices"), \ |
51 | ReductionOp<GPUDevice, type, int64, \ |
52 | Eigen::internal::ProdReducer<type>>); \ |
53 | REGISTER_KERNEL_BUILDER(Name("Prod") \ |
54 | .Device(DEVICE_GPU) \ |
55 | .TypeConstraint<type>("T") \ |
56 | .TypeConstraint<uint64>("Tidx") \ |
57 | .HostMemory("reduction_indices"), \ |
58 | ReductionOp<GPUDevice, type, uint64, \ |
59 | Eigen::internal::ProdReducer<type>>); |
60 | |
61 | TF_CALL_int32(REGISTER_GPU_KERNELS); |
62 | TF_CALL_int64(REGISTER_GPU_KERNELS); |
63 | TF_CALL_GPU_NUMBER_TYPES(REGISTER_GPU_KERNELS); |
64 | #if GOOGLE_CUDA |
65 | TF_CALL_COMPLEX_TYPES(REGISTER_GPU_KERNELS); |
66 | #endif |
67 | #undef REGISTER_GPU_KERNELS |
68 | |
69 | #endif |
70 | |
71 | |
72 | } // namespace tensorflow |
73 | |