aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_parser.cc
diff options
context:
space:
mode:
authorGravatar Michael Kuperstein <mkuper@google.com>2018-10-09 19:41:35 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 19:46:05 -0700
commit58fcfc98cd59ae3952399fc55380b8733df08df9 (patch)
tree24d5ac5d6691e73c227f5afa5ef68ba2ecba4ec0 /tensorflow/compiler/xla/service/hlo_parser.cc
parent93eef55c4d04af24a6c8080f34629db179634f07 (diff)
[XLA] Add documentation and HLO-level support for multi-value sort.
No support in any of the backends, and not yet exposed through XlaBuilder. PiperOrigin-RevId: 216465753
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_parser.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_parser.cc20
1 files changed, 4 insertions, 16 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_parser.cc b/tensorflow/compiler/xla/service/hlo_parser.cc
index 96f9ff6654..128113f7a5 100644
--- a/tensorflow/compiler/xla/service/hlo_parser.cc
+++ b/tensorflow/compiler/xla/service/hlo_parser.cc
@@ -839,8 +839,6 @@ bool HloParser::ParseInstruciontRhs(HloComputation::Builder* builder,
break;
}
case HloOpcode::kSort: {
- auto loc = lexer_.GetLoc();
-
optional<std::vector<tensorflow::int64>> dimensions;
attrs["dimensions"] = {/*required=*/true, AttrTy::kBracedInt64List,
&dimensions};
@@ -848,20 +846,10 @@ bool HloParser::ParseInstruciontRhs(HloComputation::Builder* builder,
dimensions->size() != 1) {
return false;
}
- switch (operands.size()) {
- case 1:
- instruction = builder->AddInstruction(HloInstruction::CreateSort(
- shape, dimensions->at(0), /*keys=*/operands[0]));
- break;
- case 2:
- instruction = builder->AddInstruction(HloInstruction::CreateSort(
- shape, dimensions->at(0),
- /*keys=*/operands[0], /*values=*/operands[1]));
- break;
- default:
- return Error(loc, StrCat("expects either 1 or 2 operands, but has ",
- operands.size(), " operands"));
- }
+ instruction = builder->AddInstruction(HloInstruction::CreateSort(
+ shape, dimensions->at(0),
+ /*keys=*/operands[0],
+ /*values=*/absl::Span<HloInstruction* const>(operands).subspan(1)));
break;
}
case HloOpcode::kTuple: {