From e86605c0a336c088b638da02135ea6f9f6753618 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Mon, 2 Aug 2021 14:21:27 -0700 Subject: [PATCH] Fix FPE in inpace update ops. PiperOrigin-RevId: 388303197 Change-Id: Ib48309b6213ffe53eba81004b00e889d653e4b83 --- tensorflow/core/kernels/inplace_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/kernels/inplace_ops.cc b/tensorflow/core/kernels/inplace_ops.cc index 2c0b201af3dd8..81027c7e17ee1 100644 --- a/tensorflow/core/kernels/inplace_ops.cc +++ b/tensorflow/core/kernels/inplace_ops.cc @@ -225,7 +225,7 @@ class InplaceOpBase : public OpKernel { Tensor y = x; // This creates an alias intentionally. // Skip processing if tensors are empty. - if (x.NumElements() > 0 || v.NumElements() > 0) { + if (x.NumElements() > 0 && v.NumElements() > 0) { OP_REQUIRES_OK(ctx, DoCompute(ctx, i, v, &y)); } ctx->set_output(0, y);