Increase maximum tensor rank to 7 for slice, strided_slice, and tile ops.
Change: 145477962
This commit is contained in:
parent
13c45b266a
commit
eaf96c4533
@ -13,8 +13,10 @@ tensorflow/core/kernels/tile_ops_cpu_impl_3.cc
|
||||
tensorflow/core/kernels/tile_ops_cpu_impl_4.cc
|
||||
tensorflow/core/kernels/tile_ops_cpu_impl_5.cc
|
||||
tensorflow/core/kernels/tile_ops_cpu_impl_6.cc
|
||||
tensorflow/core/kernels/tile_ops_cpu_impl_7.cc
|
||||
tensorflow/core/kernels/tensor_array_ops.cc
|
||||
tensorflow/core/kernels/tensor_array.cc
|
||||
tensorflow/core/kernels/strided_slice_op_inst_7.cc
|
||||
tensorflow/core/kernels/strided_slice_op_inst_6.cc
|
||||
tensorflow/core/kernels/strided_slice_op_inst_5.cc
|
||||
tensorflow/core/kernels/strided_slice_op_inst_4.cc
|
||||
@ -38,6 +40,7 @@ tensorflow/core/kernels/slice_op_cpu_impl_3.cc
|
||||
tensorflow/core/kernels/slice_op_cpu_impl_4.cc
|
||||
tensorflow/core/kernels/slice_op_cpu_impl_5.cc
|
||||
tensorflow/core/kernels/slice_op_cpu_impl_6.cc
|
||||
tensorflow/core/kernels/slice_op_cpu_impl_7.cc
|
||||
tensorflow/core/kernels/slice_op.cc
|
||||
tensorflow/core/kernels/shape_ops.cc
|
||||
tensorflow/core/kernels/session_ops.cc
|
||||
|
@ -83,6 +83,7 @@ tf_kernel_library(
|
||||
"strided_slice_op_inst_4.cc",
|
||||
"strided_slice_op_inst_5.cc",
|
||||
"strided_slice_op_inst_6.cc",
|
||||
"strided_slice_op_inst_7.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"dense_update_ops.h",
|
||||
@ -3481,6 +3482,7 @@ filegroup(
|
||||
"slice_op_cpu_impl_4.cc",
|
||||
"slice_op_cpu_impl_5.cc",
|
||||
"slice_op_cpu_impl_6.cc",
|
||||
"slice_op_cpu_impl_7.cc",
|
||||
"softmax_op.cc",
|
||||
"softmax_op.h",
|
||||
"softmax_op_functor.h",
|
||||
@ -3498,6 +3500,7 @@ filegroup(
|
||||
"strided_slice_op_inst_4.cc",
|
||||
"strided_slice_op_inst_5.cc",
|
||||
"strided_slice_op_inst_6.cc",
|
||||
"strided_slice_op_inst_7.cc",
|
||||
"unpack_op.cc",
|
||||
"variable_ops.cc",
|
||||
"variable_ops.h",
|
||||
@ -3683,6 +3686,7 @@ filegroup(
|
||||
"tile_ops_cpu_impl_4.cc",
|
||||
"tile_ops_cpu_impl_5.cc",
|
||||
"tile_ops_cpu_impl_6.cc",
|
||||
"tile_ops_cpu_impl_7.cc",
|
||||
"topk_op.cc",
|
||||
"training_ops.cc",
|
||||
"transpose_functor_cpu.cc",
|
||||
|
@ -179,6 +179,7 @@ class SliceOp : public OpKernel {
|
||||
HANDLE_DIM(4);
|
||||
HANDLE_DIM(5);
|
||||
HANDLE_DIM(6);
|
||||
HANDLE_DIM(7);
|
||||
|
||||
#undef HANDLE_DIM
|
||||
|
||||
@ -222,7 +223,8 @@ namespace functor {
|
||||
DECLARE_CPU_SPEC(T, 3); \
|
||||
DECLARE_CPU_SPEC(T, 4); \
|
||||
DECLARE_CPU_SPEC(T, 5); \
|
||||
DECLARE_CPU_SPEC(T, 6);
|
||||
DECLARE_CPU_SPEC(T, 6); \
|
||||
DECLARE_CPU_SPEC(T, 7);
|
||||
|
||||
TF_CALL_ALL_TYPES(DECLARE_FOR_N);
|
||||
DECLARE_FOR_N(bfloat16);
|
||||
@ -263,7 +265,8 @@ namespace functor {
|
||||
DECLARE_GPU_SPEC(T, 3); \
|
||||
DECLARE_GPU_SPEC(T, 4); \
|
||||
DECLARE_GPU_SPEC(T, 5); \
|
||||
DECLARE_GPU_SPEC(T, 6);
|
||||
DECLARE_GPU_SPEC(T, 6); \
|
||||
DECLARE_GPU_SPEC(T, 7);
|
||||
|
||||
TF_CALL_GPU_NUMBER_TYPES(DECLARE_FOR_N);
|
||||
TF_CALL_complex64(DECLARE_FOR_N);
|
||||
@ -322,7 +325,8 @@ namespace functor {
|
||||
DECLARE_SYCL_SPEC(T, 3); \
|
||||
DECLARE_SYCL_SPEC(T, 4); \
|
||||
DECLARE_SYCL_SPEC(T, 5); \
|
||||
DECLARE_SYCL_SPEC(T, 6);
|
||||
DECLARE_SYCL_SPEC(T, 6); \
|
||||
DECLARE_SYCL_SPEC(T, 7);
|
||||
|
||||
TF_CALL_GPU_NUMBER_TYPES(DECLARE_FOR_N);
|
||||
DECLARE_FOR_N(int32);
|
||||
|
18
tensorflow/core/kernels/slice_op_cpu_impl_7.cc
Normal file
18
tensorflow/core/kernels/slice_op_cpu_impl_7.cc
Normal file
@ -0,0 +1,18 @@
|
||||
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#define CPU_PROVIDED_IXDIM 7
|
||||
#include "tensorflow/core/kernels/slice_op_cpu_impl.h"
|
||||
#undef CPU_PROVIDED_IXDIM
|
@ -33,7 +33,8 @@ typedef Eigen::GpuDevice GPUDevice;
|
||||
template struct functor::Slice<GPUDevice, T, 3>; \
|
||||
template struct functor::Slice<GPUDevice, T, 4>; \
|
||||
template struct functor::Slice<GPUDevice, T, 5>; \
|
||||
template struct functor::Slice<GPUDevice, T, 6>;
|
||||
template struct functor::Slice<GPUDevice, T, 6>; \
|
||||
template struct functor::Slice<GPUDevice, T, 7>;
|
||||
|
||||
TF_CALL_GPU_NUMBER_TYPES(DEFINE_GPU_KERNELS);
|
||||
TF_CALL_complex64(DEFINE_GPU_KERNELS);
|
||||
|
@ -162,6 +162,7 @@ class StridedSliceOp : public OpKernel {
|
||||
HANDLE_DIM(4);
|
||||
HANDLE_DIM(5);
|
||||
HANDLE_DIM(6);
|
||||
HANDLE_DIM(7);
|
||||
|
||||
#undef HANDLE_DIM
|
||||
|
||||
@ -261,6 +262,7 @@ class StridedSliceGradOp : public OpKernel {
|
||||
HANDLE_DIM(4);
|
||||
HANDLE_DIM(5);
|
||||
HANDLE_DIM(6);
|
||||
HANDLE_DIM(7);
|
||||
|
||||
#undef HANDLE_DIM
|
||||
}
|
||||
@ -338,6 +340,7 @@ class StridedSliceAssignOp : public OpKernel {
|
||||
HANDLE_DIM(4);
|
||||
HANDLE_DIM(5);
|
||||
HANDLE_DIM(6);
|
||||
HANDLE_DIM(7);
|
||||
#undef HANDLE_DIM
|
||||
|
||||
OP_REQUIRES(context, false,
|
||||
|
@ -34,18 +34,21 @@ typedef Eigen::GpuDevice GPUDevice;
|
||||
template struct functor::StridedSlice<GPUDevice, T, 4>; \
|
||||
template struct functor::StridedSlice<GPUDevice, T, 5>; \
|
||||
template struct functor::StridedSlice<GPUDevice, T, 6>; \
|
||||
template struct functor::StridedSlice<GPUDevice, T, 7>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 1>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 2>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 3>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 4>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 5>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 6>; \
|
||||
template struct functor::StridedSliceGrad<GPUDevice, T, 7>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 1>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 2>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 3>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 4>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 5>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 6>; \
|
||||
template struct functor::StridedSliceAssign<GPUDevice, T, 7>; \
|
||||
template struct functor::StridedSliceAssignScalar<GPUDevice, T>;
|
||||
TF_CALL_GPU_NUMBER_TYPES(DEFINE_GPU_KERNELS);
|
||||
DEFINE_GPU_KERNELS(int32);
|
||||
|
23
tensorflow/core/kernels/strided_slice_op_inst_7.cc
Normal file
23
tensorflow/core/kernels/strided_slice_op_inst_7.cc
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#define EIGEN_USE_THREADS
|
||||
#if GOOGLE_CUDA
|
||||
#define EIGEN_USE_GPU
|
||||
#endif
|
||||
|
||||
#define STRIDED_SLICE_INSTANTIATE_DIM 7
|
||||
#include "tensorflow/core/kernels/strided_slice_op_impl.h"
|
||||
#undef STRIDED_SLICE_INSTANTIATE_DIM
|
@ -142,7 +142,8 @@ class TileOp : public OpKernel {
|
||||
HANDLE_DIM(T, 3) \
|
||||
HANDLE_DIM(T, 4) \
|
||||
HANDLE_DIM(T, 5) \
|
||||
HANDLE_DIM(T, 6)
|
||||
HANDLE_DIM(T, 6) \
|
||||
HANDLE_DIM(T, 7)
|
||||
|
||||
#define HANDLE_TYPE_NAME(T) HANDLE_TYPE(DataTypeToEnum<T>::value)
|
||||
|
||||
@ -220,7 +221,8 @@ inline void TileOp<Device>::HandleCase(
|
||||
HANDLE_CASE(device, T, dtype, 3); \
|
||||
HANDLE_CASE(device, T, dtype, 4); \
|
||||
HANDLE_CASE(device, T, dtype, 5); \
|
||||
HANDLE_CASE(device, T, dtype, 6);
|
||||
HANDLE_CASE(device, T, dtype, 6); \
|
||||
HANDLE_CASE(device, T, dtype, 7);
|
||||
|
||||
#define HANDLE_TYPE_NAME_CPU(T) \
|
||||
HANDLE_CASE_DIM(CPUDevice, T, DataTypeToEnum<T>::value);
|
||||
@ -327,7 +329,8 @@ class TileGradientOp : public OpKernel {
|
||||
HANDLE_DIM(T, 3) \
|
||||
HANDLE_DIM(T, 4) \
|
||||
HANDLE_DIM(T, 5) \
|
||||
HANDLE_DIM(T, 6)
|
||||
HANDLE_DIM(T, 6) \
|
||||
HANDLE_DIM(T, 7)
|
||||
|
||||
#define HANDLE_TYPE_NAME(T) HANDLE_TYPE(DataTypeToEnum<T>::value)
|
||||
|
||||
@ -474,7 +477,8 @@ inline void TileGradientOp<Device>::HandleCase(
|
||||
HANDLE_CASE(device, T, dtype, 3); \
|
||||
HANDLE_CASE(device, T, dtype, 4); \
|
||||
HANDLE_CASE(device, T, dtype, 5); \
|
||||
HANDLE_CASE(device, T, dtype, 6);
|
||||
HANDLE_CASE(device, T, dtype, 6); \
|
||||
HANDLE_CASE(device, T, dtype, 7);
|
||||
|
||||
#define HANDLE_TYPE_NAME_CPU(T) \
|
||||
HANDLE_CASE_DIM(CPUDevice, T, DataTypeToEnum<T>::value);
|
||||
|
18
tensorflow/core/kernels/tile_ops_cpu_impl_7.cc
Normal file
18
tensorflow/core/kernels/tile_ops_cpu_impl_7.cc
Normal file
@ -0,0 +1,18 @@
|
||||
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#define CPU_PROVIDED_IXDIM 7
|
||||
#include "tensorflow/core/kernels/tile_ops_cpu_impl.h"
|
||||
#undef CPU_PROVIDED_IXDIM
|
Loading…
Reference in New Issue
Block a user