Home | History | Annotate | Download | only in kernels
      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/cwise_ops_common.h"
     17 
     18 namespace tensorflow {
     19 REGISTER5(BinaryOp, CPU, "FloorDiv", functor::safe_floor_div, uint8, uint16,
     20           int16, int32, int64);
     21 REGISTER3(BinaryOp, CPU, "FloorDiv", functor::floor_div_real, float,
     22           Eigen::half, double);
     23 
     24 #if GOOGLE_CUDA
     25 REGISTER4(BinaryOp, GPU, "FloorDiv", functor::floor_div, uint8, uint16, int16,
     26           int64);
     27 REGISTER3(BinaryOp, GPU, "FloorDiv", functor::floor_div_real, float,
     28           Eigen::half, double);
     29 #endif
     30 
     31 #if GOOGLE_CUDA
     32 // A special GPU kernel for int32.
     33 // TODO(b/25387198): Also enable int32 in device memory. This kernel
     34 // registration requires all int32 inputs and outputs to be in host memory.
     35 REGISTER_KERNEL_BUILDER(Name("FloorDiv")
     36                             .Device(DEVICE_GPU)
     37                             .HostMemory("x")
     38                             .HostMemory("y")
     39                             .HostMemory("z")
     40                             .TypeConstraint<int32>("T"),
     41                         BinaryOp<CPUDevice, functor::safe_floor_div<int32>>);
     42 #endif
     43 
     44 #ifdef TENSORFLOW_USE_SYCL
     45 REGISTER_KERNEL_BUILDER(Name("FloorDiv")
     46                             .Device(DEVICE_SYCL)
     47                             .HostMemory("x")
     48                             .HostMemory("y")
     49                             .HostMemory("z")
     50                             .TypeConstraint<int32>("T"),
     51                         BinaryOp<CPUDevice, functor::safe_floor_div<int32>>);
     52 #endif  // TENSORFLOW_USE_SYCL
     53 }  // namespace tensorflow
     54