diff options
author | Michael Kuperstein <mkuper@google.com> | 2018-06-26 10:30:06 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-26 10:35:15 -0700 |
commit | 4dc57fb74b7885a5ef468bc5fced373724d4ac59 (patch) | |
tree | 6b2edb71f2cef79fbfadaedbf9f177c3aad1a99d /tensorflow/compiler/xla/layout_util.cc | |
parent | e3f8aaafab7c164e1cfd03d2ba11a45c825d3430 (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.cc | 6 |
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(); } |