Skip to content

Commit

Permalink
Fix FPE issue with tf.raw_ops.Reverse.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 371176973
Change-Id: Ic6d483bfc95313ec2299c2d1c956cfe96c96626c
  • Loading branch information
Amit Patankar authored and tensorflower-gardener committed Apr 29, 2021
1 parent 36229ea commit 4071d8e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tensorflow/core/kernels/reverse_op.cc
Expand Up @@ -155,6 +155,12 @@ class ReverseOp : public OpKernel {

void Compute(OpKernelContext* context) override {
const Tensor& input = context->input(0);
// If input is provided, check to make sure the first dimension is valid.
if (input.dims() > 0) {
OP_REQUIRES(
context, input.dim_size(0) != 0,
errors::InvalidArgument("Invalid input first dimension. Found 0."));
}
const Tensor& dims = context->input(1);

if (TensorShapeUtils::IsScalar(input.shape())) {
Expand Down

0 comments on commit 4071d8e

Please sign in to comment.