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 // Functors for 3d convolution.
     17 
     18 #ifndef TENSORFLOW_KERNELS_CONV_3D_H_
     19 #define TENSORFLOW_KERNELS_CONV_3D_H_
     20 
     21 #include "tensorflow/core/framework/tensor_types.h"
     22 #include "tensorflow/core/kernels/eigen_cuboid_convolution.h"
     23 
     24 namespace tensorflow {
     25 namespace functor {
     26 
     27 // Applies a 3D convolution to a batch of multi-channel volumes.
     28 template <typename Device, typename T>
     29 struct CuboidConvolution;
     30 
     31 typedef Eigen::ThreadPoolDevice CPUDevice;
     32 
     33 template <typename T>
     34 struct CuboidConvolution<CPUDevice, T> {
     35   void operator()(const CPUDevice& d, typename TTypes<T, 5>::Tensor output,
     36                   typename TTypes<T, 5>::ConstTensor input,
     37                   typename TTypes<T, 5>::ConstTensor filter, int stride_planes,
     38                   int stride_rows, int stride_cols,
     39                   const Eigen::PaddingType& padding) {
     40     output.device(d) = Eigen::CuboidConvolution(
     41         input, filter, stride_planes, stride_rows, stride_cols, padding);
     42   }
     43 };
     44 
     45 }  // namespace functor
     46 }  // namespace tensorflow
     47 
     48 #endif  // TENSORFLOW_KERNELS_CONV_3D_H_
     49