From 09e75d408bc98a6d6830ac458472019a94655e44 Mon Sep 17 00:00:00 2001 From: "David G. Andersen" Date: Fri, 27 May 2016 11:44:28 -0800 Subject: [PATCH] Very Large Tensors: Force 64 bit indexing on GPU if total size of tensor is too large for 32 bit. This change is barely relevant - the only way to bump into it today is using half-precision floats, and even that's a stretch - but might as well anticipate the future. Change: 123445306 --- tensorflow/core/kernels/slice_op.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tensorflow/core/kernels/slice_op.h b/tensorflow/core/kernels/slice_op.h index a906724be95..18047396256 100644 --- a/tensorflow/core/kernels/slice_op.h +++ b/tensorflow/core/kernels/slice_op.h @@ -30,7 +30,9 @@ struct Slice { typename TTypes::ConstTensor input, const Eigen::DSizes& slice_indices, const Eigen::DSizes& slice_sizes) { - if (Eigen::internal::is_same::value) { + bool use_64bit = (input.size() > Eigen::NumTraits::highest()); + if (!use_64bit && + Eigen::internal::is_same::value) { Eigen::DSizes indices; for (int i = 0; i < NDIMS; ++i) { indices[i] = slice_indices[i];