Don't try t gather from empty tensors

PiperOrigin-RevId: 312361331
Change-Id: I8f81add090d9a5452e671c48a03e0f5cb9f81a41
This commit is contained in:
Mihai Maruseac 2020-05-19 15:06:11 -07:00 committed by TensorFlower Gardener
parent 53215ab702
commit af2263101b

View File

@ -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<Index>();