From af2263101b0407ff1fb7f7e492565f1edc4cee30 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Tue, 19 May 2020 15:06:11 -0700 Subject: [PATCH] Don't try t gather from empty tensors PiperOrigin-RevId: 312361331 Change-Id: I8f81add090d9a5452e671c48a03e0f5cb9f81a41 --- tensorflow/core/kernels/gather_op.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/core/kernels/gather_op.cc b/tensorflow/core/kernels/gather_op.cc index 849a2b4389f..3ff7afca7df 100644 --- a/tensorflow/core/kernels/gather_op.cc +++ b/tensorflow/core/kernels/gather_op.cc @@ -154,6 +154,7 @@ class GatherOp : public OpKernel { Tensor* out = nullptr; OP_REQUIRES_OK(c, c->allocate_output(0, result_shape, &out)); if (N == 0) return; + if (inner_size == 0) return; int64 bad_i = -1; auto indices_flat = indices.flat();