aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_matchers.h
diff options
context:
space:
mode:
authorGravatar Justin Lebar <jlebar@google.com>2018-01-25 16:45:52 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-25 16:53:16 -0800
commit879ea264780e6867ac48f507cddcdd9cb1e9b544 (patch)
treee99f40fd96eb8e3a9200b926a49d6e3c4df0352c /tensorflow/compiler/xla/service/hlo_matchers.h
parent1b44a76921295fa5dfa7271f3a486b0ceaa8b3e1 (diff)
Automated g4 rollback of changelist 183296506
PiperOrigin-RevId: 183312680
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_matchers.h')
-rw-r--r--tensorflow/compiler/xla/service/hlo_matchers.h53
1 files changed, 3 insertions, 50 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_matchers.h b/tensorflow/compiler/xla/service/hlo_matchers.h
index 103f04a2cb..9206cdac05 100644
--- a/tensorflow/compiler/xla/service/hlo_matchers.h
+++ b/tensorflow/compiler/xla/service/hlo_matchers.h
@@ -56,8 +56,8 @@ class HloParameterMatcher : public HloMatcher {
// index to match.
class HloGetTupleElementMatcher : public HloMatcher {
public:
- HloGetTupleElementMatcher(::testing::Matcher<const HloInstruction*> operand,
- int64 tuple_index)
+ explicit HloGetTupleElementMatcher(
+ ::testing::Matcher<const HloInstruction*> operand, int64 tuple_index)
: HloMatcher(HloOpcode::kGetTupleElement, /*operands=*/{operand}),
tuple_index_(tuple_index) {}
@@ -68,24 +68,6 @@ class HloGetTupleElementMatcher : public HloMatcher {
int64 tuple_index_;
};
-// Custom matcher for custom-call instructions, which accepts a matcher for its
-// call target.
-class HloCustomCallMatcher : public HloMatcher {
- public:
- HloCustomCallMatcher(
- ::testing::Matcher<string> call_target_matcher,
- std::vector<::testing::Matcher<const HloInstruction*>> operands)
- : HloMatcher(HloOpcode::kCustomCall, operands),
- call_target_matcher_(call_target_matcher) {}
-
- bool MatchAndExplain(const HloInstruction* instruction,
- ::testing::MatchResultListener* listener) const override;
- void DescribeTo(std::ostream* os) const override;
-
- private:
- ::testing::Matcher<string> call_target_matcher_;
-};
-
// HloInstruction* matchers for opcode and operands. Example:
// namespace op = xla::opcode_matchers;
// EXPECT_THAT(instruction,
@@ -112,6 +94,7 @@ HLO_MATCHER(Convert);
HLO_MATCHER(Convolution);
HLO_MATCHER(Copy);
HLO_MATCHER(CrossReplicaSum);
+HLO_MATCHER(CustomCall);
HLO_MATCHER(Divide);
HLO_MATCHER(Dot);
HLO_MATCHER(DynamicSlice);
@@ -201,36 +184,6 @@ inline ::testing::Matcher<const ::xla::HloInstruction*> GetTupleElement() {
new ::xla::testing::HloMatcher(HloOpcode::kGetTupleElement, {}));
}
-// - CustomCall(T, operand1, ..., operandN) matches a CustomCall with call
-// target T and the given operands.
-//
-// - CustomCall(operand1, ..., operandN) matches any CustomCall HLO with the
-// given operands.
-//
-// - CustomCall() matches any CustomCall HLO at all.
-template <typename... M>
-inline ::testing::Matcher<const ::xla::HloInstruction*> CustomCall(
- ::testing::Matcher<string> call_target_matcher, M... operands) {
- return ::testing::MakeMatcher(new ::xla::testing::HloCustomCallMatcher(
- call_target_matcher, {operands...}));
-}
-// This overload of CustomCall(A, B, C, ...) exists iff A is not convertible to
-// ::testing::Matcher<string>. In that case, we want to prefer the overload
-// above.
-template <typename FirstM, typename... M,
- typename Dummy = typename std::enable_if<
- !std::is_convertible<FirstM, ::testing::Matcher<string>>::value,
- void>::type*>
-inline ::testing::Matcher<const ::xla::HloInstruction*> CustomCall(
- FirstM operands_first, M... operands_rest) {
- return ::testing::MakeMatcher(new ::xla::testing::HloMatcher(
- HloOpcode::kCustomCall, {operands_first, operands_rest...}));
-}
-inline ::testing::Matcher<const ::xla::HloInstruction*> CustomCall() {
- return ::testing::MakeMatcher(
- new ::xla::testing::HloMatcher(HloOpcode::kCustomCall, {}));
-}
-
#undef HLO_MATCHER
} // namespace opcode_matchers