1 /* Copyright 2018 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 #ifndef TENSORFLOW_KERNELS_IMAGE_EXTRACT_VOLUME_PATCHES_OP_H_ 17 #define TENSORFLOW_KERNELS_IMAGE_EXTRACT_VOLUME_PATCHES_OP_H_ 18 19 #include "tensorflow/core/framework/tensor_shape.h" 20 #include "tensorflow/core/framework/tensor_types.h" 21 #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" 22 23 namespace tensorflow { 24 namespace functor { 25 26 template <typename Device, typename T> 27 struct ExtractVolumePatchesForward { operatorExtractVolumePatchesForward28 void operator()(const Device& d, typename TTypes<T, 5>::ConstTensor input, 29 int patch_planes, int patch_rows, int patch_cols, 30 int stride_planes, int stride_rows, int stride_cols, 31 /* int rate_planes, int rate_rows, int rate_cols, */ 32 const Eigen::PaddingType& padding, 33 typename TTypes<T, 5>::Tensor output) { 34 MaybeWith32BitIndexing<Device>( 35 [&](auto input32, auto output32) { 36 output32.device(d) = 37 input32 38 .extract_volume_patches(patch_cols, patch_rows, patch_planes, 39 stride_cols, stride_rows, 40 stride_planes, padding) 41 .reshape(output32.dimensions()); 42 }, 43 input, output); 44 } 45 }; 46 47 } // namespace functor 48 } // namespace tensorflow 49 50 #endif // TENSORFLOW_KERNELS_IMAGE_EXTRACT_VOLUME_PATCHES_OP_H_ 51