Skip to content

Commit 9728c60

Browse files
Ensure validation sticks in save_restore_v2_ops.cc
PiperOrigin-RevId: 387924206 Change-Id: I6156842eb3230076b5812c0815f3e66bd5241454
1 parent f2a673b commit 9728c60

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tensorflow/core/kernels/save_restore_v2_ops.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class SaveV2 : public OpKernel {
9898
const Tensor& shape_and_slices = context->input(2);
9999
ValidateInputs(true /* is save op */, context, prefix, tensor_names,
100100
shape_and_slices);
101+
if (!context->status().ok()) return;
101102

102103
const int kFixedInputs = 3; // Prefix, tensor names, shape_and_slices.
103104
const int num_tensors = static_cast<int>(tensor_names.NumElements());
@@ -177,6 +178,7 @@ class RestoreV2 : public OpKernel {
177178
" expected dtypes."));
178179
ValidateInputs(false /* not save op */, context, prefix, tensor_names,
179180
shape_and_slices);
181+
if (!context->status().ok()) return;
180182

181183
const string& prefix_string = prefix.scalar<tstring>()();
182184

0 commit comments

Comments
 (0)