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
This commit is contained in:
David G. Andersen 2016-05-27 11:44:28 -08:00 committed by TensorFlower Gardener
parent 23c79213ec
commit 09e75d408b

View File

@ -30,7 +30,9 @@ struct Slice {
typename TTypes<T, NDIMS>::ConstTensor input,
const Eigen::DSizes<Eigen::DenseIndex, NDIMS>& slice_indices,
const Eigen::DSizes<Eigen::DenseIndex, NDIMS>& slice_sizes) {
if (Eigen::internal::is_same<Device, Eigen::GpuDevice>::value) {
bool use_64bit = (input.size() > Eigen::NumTraits<int>::highest());
if (!use_64bit &&
Eigen::internal::is_same<Device, Eigen::GpuDevice>::value) {
Eigen::DSizes<int, NDIMS> indices;
for (int i = 0; i < NDIMS; ++i) {
indices[i] = slice_indices[i];