Home | History | Annotate | Download | only in kernels
      1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
      2 Licensed under the Apache License, Version 2.0 (the "License");
      3 you may not use this file except in compliance with the License.
      4 You may obtain a copy of the License at
      5 
      6     http://www.apache.org/licenses/LICENSE-2.0
      7 
      8 Unless required by applicable law or agreed to in writing, software
      9 distributed under the License is distributed on an "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     11 See the License for the specific language governing permissions and
     12 limitations under the License.
     13 ==============================================================================*/
     14 
     15 #if GOOGLE_CUDA
     16 
     17 #define EIGEN_USE_GPU
     18 
     19 #include "tensorflow/core/kernels/adjust_hsv_gpu.cu.h"
     20 #include "tensorflow/core/kernels/adjust_saturation_op.h"
     21 #include "tensorflow/core/util/cuda_kernel_helper.h"
     22 
     23 namespace tensorflow {
     24 
     25 namespace functor {
     26 
     27 void AdjustSaturationGPU::operator()(GPUDevice* device,
     28                                      const int64 number_of_elements,
     29                                      const float* const input,
     30                                      const float* const scale,
     31                                      float* const output) {
     32   const auto stream = device->stream();
     33   const CudaLaunchConfig config =
     34       GetCudaLaunchConfig(number_of_elements, *device);
     35   const int threads_per_block = config.thread_per_block;
     36   const int block_count =
     37       (number_of_elements + threads_per_block - 1) / threads_per_block;
     38   internal::adjust_hsv_nhwc<false, true, false>
     39       <<<block_count, threads_per_block, 0, stream>>>(
     40           number_of_elements, input, output, nullptr, scale, nullptr);
     41 }
     42 }  // namespace functor
     43 }  // namespace tensorflow
     44 #endif  // GOOGLE_CUDA
     45