aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/slice_op.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-08-16 16:45:09 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-08-16 17:47:45 -0700
commitb07575c71084b8dea34be0f5ae50ce8dff3751d3 (patch)
treebf33650a0863aa4bff0124a9848d7042c0404484 /tensorflow/core/kernels/slice_op.cc
parent014cc05a114d1071c8f88387a655c15847d196d8 (diff)
Split slice_op into multiple files to improve compilation times for CPU.
Change: 130469255
Diffstat (limited to 'tensorflow/core/kernels/slice_op.cc')
-rw-r--r--tensorflow/core/kernels/slice_op.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/tensorflow/core/kernels/slice_op.cc b/tensorflow/core/kernels/slice_op.cc
index 57f6892b9e..6d40167f09 100644
--- a/tensorflow/core/kernels/slice_op.cc
+++ b/tensorflow/core/kernels/slice_op.cc
@@ -201,6 +201,33 @@ class SliceOp : public OpKernel {
}
};
+// Forward declarations of the functor specializations for declared in the
+// sharded source files.
+namespace functor {
+#define DECLARE_CPU_SPEC(T, NDIM) \
+ template <> \
+ void Slice<CPUDevice, T, NDIM>::operator()( \
+ const CPUDevice& d, typename TTypes<T, NDIM>::Tensor output, \
+ typename TTypes<T, NDIM>::ConstTensor input, \
+ const Eigen::DSizes<Eigen::DenseIndex, NDIM>& indices, \
+ const Eigen::DSizes<Eigen::DenseIndex, NDIM>& sizes); \
+ extern template struct Slice<CPUDevice, T, NDIM>;
+
+#define DECLARE_FOR_N(T) \
+ DECLARE_CPU_SPEC(T, 1); \
+ DECLARE_CPU_SPEC(T, 2); \
+ DECLARE_CPU_SPEC(T, 3); \
+ DECLARE_CPU_SPEC(T, 4); \
+ DECLARE_CPU_SPEC(T, 5); \
+ DECLARE_CPU_SPEC(T, 6);
+
+TF_CALL_ALL_TYPES(DECLARE_FOR_N);
+DECLARE_FOR_N(bfloat16);
+
+#undef DECLARE_FOR_N
+#undef DECLARE_CPU_SPEC
+} // namespace functor
+
#define REGISTER_SLICE(type) \
REGISTER_KERNEL_BUILDER(Name("Slice") \
.Device(DEVICE_CPU) \