diff options
author | Eli Bendersky <eliben@google.com> | 2017-07-21 11:43:35 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-07-21 11:47:42 -0700 |
commit | ae0207d3820308d882253c85fe58494b818f254d (patch) | |
tree | 451f4af9fc710a4b16fe016cc9fc5ac4d666c646 /tensorflow/compiler/xla/layout_util.cc | |
parent | 40bf259e711b84744177e89574c88b59cc1f3030 (diff) |
[XLA] Remove the xla_default_layout flag.
The default layout is just major-to-minor, as we don't have sufficient testing
for alternative default layouts.
PiperOrigin-RevId: 162766231
Diffstat (limited to 'tensorflow/compiler/xla/layout_util.cc')
-rw-r--r-- | tensorflow/compiler/xla/layout_util.cc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/tensorflow/compiler/xla/layout_util.cc b/tensorflow/compiler/xla/layout_util.cc index 119c4e373f..35a563bf22 100644 --- a/tensorflow/compiler/xla/layout_util.cc +++ b/tensorflow/compiler/xla/layout_util.cc @@ -23,7 +23,6 @@ limitations under the License. #include <unordered_map> #include <vector> -#include "tensorflow/compiler/xla/legacy_flags/layout_util_flags.h" #include "tensorflow/compiler/xla/protobuf_util.h" #include "tensorflow/compiler/xla/shape_util.h" #include "tensorflow/compiler/xla/status_macros.h" @@ -39,35 +38,17 @@ limitations under the License. namespace xla { namespace { -using DimensionOrder = legacy_flags::DefaultLayout::DimensionOrder; - // Internal helper for GetDefaultLayoutForShape and SetToDefaultLayout. Sets // minor_to_major to the value that represents the default layout. void SetDefaultLayoutToContainer( tensorflow::protobuf::RepeatedField<tensorflow::protobuf_int64>* minor_to_major) { + // The default XLA layout is major-to-minor (dim 0 is major). + // For more information on XLA layouts, see: + // https://www.tensorflow.org/performance/xla/shapes const int64 size = minor_to_major->size(); - legacy_flags::LayoutUtilFlags* flags = legacy_flags::GetLayoutUtilFlags(); - auto default_layout = flags->xla_default_layout; - switch (default_layout.dimension_order) { - case DimensionOrder::kMajorToMinor: - for (int64 i = 0; i < size; ++i) { - minor_to_major->Set(i, size - 1 - i); - } - break; - case DimensionOrder::kMinorToMajor: - for (int64 i = 0; i < size; ++i) { - minor_to_major->Set(i, i); - } - break; - case DimensionOrder::kRandom: - for (int64 i = 0; i < size; ++i) { - minor_to_major->Set(i, i); - } - std::shuffle( - minor_to_major->begin(), minor_to_major->end(), - std::mt19937(default_layout.seed != 0 ? default_layout.seed - : std::random_device()())); + for (int64 i = 0; i < size; ++i) { + minor_to_major->Set(i, size - 1 - i); } } |