27 lines
1.2 KiB
Diff
27 lines
1.2 KiB
Diff
|
|
From ecf768cbe50cedc0a45ce1ee223146a3d3d26d23 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mihai Maruseac <mihaimaruseac@google.com>
|
||
|
|
Date: Wed, 5 May 2021 12:07:57 -0700
|
||
|
|
Subject: [PATCH] Add missing validations to reverse_sequence_op
|
||
|
|
|
||
|
|
PiperOrigin-RevId: 372178683
|
||
|
|
Change-Id: Iac97ebab5b342f1262c77a7d9bcb4267b305ce5b
|
||
|
|
---
|
||
|
|
tensorflow/core/kernels/reverse_sequence_op.cc | 4 ++++
|
||
|
|
1 file changed, 4 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/tensorflow/core/kernels/reverse_sequence_op.cc b/tensorflow/core/kernels/reverse_sequence_op.cc
|
||
|
|
index b5b62bc76ca52..1282deb26e8cd 100644
|
||
|
|
--- a/tensorflow/core/kernels/reverse_sequence_op.cc
|
||
|
|
+++ b/tensorflow/core/kernels/reverse_sequence_op.cc
|
||
|
|
@@ -115,6 +115,10 @@ class ReverseSequenceOp : public OpKernel {
|
||
|
|
: OpKernel(context) {
|
||
|
|
OP_REQUIRES_OK(context, context->GetAttr("batch_dim", &batch_dim_));
|
||
|
|
OP_REQUIRES_OK(context, context->GetAttr("seq_dim", &seq_dim_));
|
||
|
|
+ OP_REQUIRES(context, batch_dim_ >= 0,
|
||
|
|
+ errors::InvalidArgument("Invalid batch_dim ", batch_dim_));
|
||
|
|
+ OP_REQUIRES(context, seq_dim_ >= 0,
|
||
|
|
+ errors::InvalidArgument("Invalid seq_dim ", seq_dim_));
|
||
|
|
}
|
||
|
|
|
||
|
|
void Compute(OpKernelContext* context) override {
|