Skip to content

Commit

Permalink
Merge pull request #49548 from geetachavan1/cherrypicks_SBBYG
Browse files Browse the repository at this point in the history
Fix FPE issue with `tf.raw_ops.Reverse`.
  • Loading branch information
mihaimaruseac committed May 27, 2021
2 parents a525ac6 + 9b1956d commit 5cf9b08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tensorflow/core/kernels/reverse_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,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 5cf9b08

Please sign in to comment.