aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc
diff options
context:
space:
mode:
authorGravatar Peter Hawkins <phawkins@google.com>2017-07-05 10:10:03 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-05 10:14:25 -0700
commit19220809123803af8fdcbbe628ee9f80fb4521c8 (patch)
tree674109a5d013d044c31c5b265307f4a7d862b2c2 /tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc
parent94d52acdc0087d5829f220c4d46eea67e0d30305 (diff)
[TF:XLA] Refactor XLAShapeToTensorShape so it returns an error Status if passed an XLA tuple shape, rather than CHECK-failing.
PiperOrigin-RevId: 160971216
Diffstat (limited to 'tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc')
-rw-r--r--tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc b/tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc
index 9367c1ef22..d720496f74 100644
--- a/tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc
+++ b/tensorflow/compiler/tf2xla/kernels/tensor_array_ops.cc
@@ -74,7 +74,9 @@ Status MaybeInitializeTensorArray(xla::ComputationBuilder* builder,
if (!shape_or_status.ok()) {
return shape_or_status.status();
}
- TensorShape shape = XLAShapeToTensorShape(*shape_or_status.ValueOrDie());
+ TensorShape shape;
+ TF_RETURN_IF_ERROR(
+ XLAShapeToTensorShape(*shape_or_status.ValueOrDie(), &shape));
if (ta_shape != shape) {
return errors::InvalidArgument(
"Mismatched TensorArray sizes: ", ta_shape.DebugString(), " vs ",
@@ -115,7 +117,8 @@ Status GetTensorArrayShape(const XlaResource* resource,
if (!shape_or_status.ok()) {
return shape_or_status.status();
}
- *shape = XLAShapeToTensorShape(*shape_or_status.ValueOrDie());
+ TF_RETURN_IF_ERROR(
+ XLAShapeToTensorShape(*shape_or_status.ValueOrDie(), shape));
if (shape->dims() < 1) {
return errors::InvalidArgument("TensorArray rank must be >= 1");
}