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