aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/layout_util.cc
diff options
context:
space:
mode:
authorGravatar Michael Kuperstein <mkuper@google.com>2018-06-26 10:30:06 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-26 10:35:15 -0700
commit4dc57fb74b7885a5ef468bc5fced373724d4ac59 (patch)
tree6b2edb71f2cef79fbfadaedbf9f177c3aad1a99d /tensorflow/compiler/xla/layout_util.cc
parente3f8aaafab7c164e1cfd03d2ba11a45c825d3430 (diff)
[XLA] Try to validate that shape sizes are sane.
This won't catch all overflows, but will do the right thing for the "normal" flow. Also fix layout validation to reject padded sparse layouts. PiperOrigin-RevId: 202151215
Diffstat (limited to 'tensorflow/compiler/xla/layout_util.cc')
-rw-r--r--tensorflow/compiler/xla/layout_util.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/layout_util.cc b/tensorflow/compiler/xla/layout_util.cc
index 3f059cac30..15eeb2ea13 100644
--- a/tensorflow/compiler/xla/layout_util.cc
+++ b/tensorflow/compiler/xla/layout_util.cc
@@ -248,6 +248,12 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
}
}
+ if (layout.format() == SPARSE) {
+ if (!layout.padded_dimensions().empty()) {
+ return InvalidArgument("Sparse layout has padded dimensions");
+ }
+ }
+
return Status::OK();
}