aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tensorflow/compiler/tests/randomized_tests.cc12
-rw-r--r--tensorflow/compiler/xla/client/lib/arithmetic.cc10
-rw-r--r--tensorflow/compiler/xla/client/lib/arithmetic.h4
-rw-r--r--tensorflow/compiler/xla/service/dfs_hlo_visitor.h17
-rw-r--r--tensorflow/compiler/xla/service/hlo_evaluator.cc27
-rw-r--r--tensorflow/compiler/xla/service/hlo_instruction.cc6
-rw-r--r--tensorflow/compiler/xla/tests/reduce_test.cc18
7 files changed, 45 insertions, 49 deletions
diff --git a/tensorflow/compiler/tests/randomized_tests.cc b/tensorflow/compiler/tests/randomized_tests.cc
index 7e307f16af..fef12d9397 100644
--- a/tensorflow/compiler/tests/randomized_tests.cc
+++ b/tensorflow/compiler/tests/randomized_tests.cc
@@ -1791,28 +1791,28 @@ TEST_F(OpTest, Log1p) {
});
}
-TEST_F(OpTest, LogicalAnd) {
+TEST_F(OpTest, BooleanAnd) {
Repeatedly([this]() {
auto dims = BroadcastableDims();
return ExpectTfAndXlaOutputsAreClose(
- OpTestBuilder("LogicalAnd")
+ OpTestBuilder("BooleanAnd")
.RandomInput(DT_BOOL, dims.first)
.RandomInput(DT_BOOL, dims.second));
});
}
-TEST_F(OpTest, LogicalNot) {
+TEST_F(OpTest, BooleanNot) {
Repeatedly([this]() {
return ExpectTfAndXlaOutputsAreClose(
- OpTestBuilder("LogicalNot").RandomInput(DT_BOOL));
+ OpTestBuilder("BooleanNot").RandomInput(DT_BOOL));
});
}
-TEST_F(OpTest, LogicalOr) {
+TEST_F(OpTest, BooleanOr) {
Repeatedly([this]() {
auto dims = BroadcastableDims();
return ExpectTfAndXlaOutputsAreClose(
- OpTestBuilder("LogicalOr")
+ OpTestBuilder("BooleanOr")
.RandomInput(DT_BOOL, dims.first)
.RandomInput(DT_BOOL, dims.second));
});
diff --git a/tensorflow/compiler/xla/client/lib/arithmetic.cc b/tensorflow/compiler/xla/client/lib/arithmetic.cc
index 99e9f2dbb2..24048a1e5a 100644
--- a/tensorflow/compiler/xla/client/lib/arithmetic.cc
+++ b/tensorflow/compiler/xla/client/lib/arithmetic.cc
@@ -89,16 +89,16 @@ Computation CreateScalarMinComputation(PrimitiveType type,
const ComputationDataHandle& rhs) { return b->Min(lhs, rhs); });
}
-Computation CreateScalarLogicalAndComputation(ComputationBuilder* builder) {
+Computation CreateScalarAndComputation(ComputationBuilder* builder) {
return CreateScalarComputation(
- "logical_and", PRED, builder,
+ "and", PRED, builder,
[](ComputationBuilder* b, const ComputationDataHandle& lhs,
const ComputationDataHandle& rhs) { return b->And(lhs, rhs); });
}
-Computation CreateScalarLogicalOrComputation(ComputationBuilder* builder) {
+Computation CreateScalarOrComputation(ComputationBuilder* builder) {
return CreateScalarComputation(
- "logical_or", PRED, builder,
+ "or", PRED, builder,
[](ComputationBuilder* b, const ComputationDataHandle& lhs,
const ComputationDataHandle& rhs) { return b->Or(lhs, rhs); });
}
@@ -106,7 +106,7 @@ Computation CreateScalarLogicalOrComputation(ComputationBuilder* builder) {
StatusOr<ComputationDataHandle> Any(const ComputationDataHandle& predicates,
ComputationBuilder* builder) {
auto f = builder->ConstantR0<bool>(false);
- Computation logical_or = CreateScalarLogicalOrComputation(builder);
+ Computation logical_or = CreateScalarOrComputation(builder);
TF_ASSIGN_OR_RETURN(std::unique_ptr<Shape> predicates_shape,
builder->GetShape(predicates));
std::vector<int64> all_dimensions(ShapeUtil::Rank(*predicates_shape));
diff --git a/tensorflow/compiler/xla/client/lib/arithmetic.h b/tensorflow/compiler/xla/client/lib/arithmetic.h
index f43d35fe4a..ae89784bc2 100644
--- a/tensorflow/compiler/xla/client/lib/arithmetic.h
+++ b/tensorflow/compiler/xla/client/lib/arithmetic.h
@@ -45,10 +45,10 @@ Computation CreateScalarMinComputation(PrimitiveType type,
ComputationBuilder* builder);
// Creates a scalar logical AND computation and returns it.
-Computation CreateScalarLogicalAndComputation(ComputationBuilder* builder);
+Computation CreateScalarAndComputation(ComputationBuilder* builder);
// Creates a scalar logical OR computation and returns it.
-Computation CreateScalarLogicalOrComputation(ComputationBuilder* builder);
+Computation CreateScalarOrComputation(ComputationBuilder* builder);
// Returns whether any predicate in "predicates" is set.
//
diff --git a/tensorflow/compiler/xla/service/dfs_hlo_visitor.h b/tensorflow/compiler/xla/service/dfs_hlo_visitor.h
index 2c16a1b903..8c864f3d07 100644
--- a/tensorflow/compiler/xla/service/dfs_hlo_visitor.h
+++ b/tensorflow/compiler/xla/service/dfs_hlo_visitor.h
@@ -156,17 +156,16 @@ class DfsHloVisitor {
HloInstruction* operand) {
return HandleElementwiseUnary(is_finite);
}
- virtual Status HandleLogicalAnd(HloInstruction* logical_and,
- HloInstruction* lhs, HloInstruction* rhs) {
- return HandleElementwiseBinary(logical_and);
+ virtual Status HandleAnd(HloInstruction* and_, HloInstruction* lhs,
+ HloInstruction* rhs) {
+ return HandleElementwiseBinary(and_);
}
- virtual Status HandleLogicalNot(HloInstruction* logical_not,
- HloInstruction* operand) {
- return HandleElementwiseUnary(logical_not);
+ virtual Status HandleNot(HloInstruction* not_, HloInstruction* operand) {
+ return HandleElementwiseUnary(not_);
}
- virtual Status HandleLogicalOr(HloInstruction* logical_or,
- HloInstruction* lhs, HloInstruction* rhs) {
- return HandleElementwiseBinary(logical_or);
+ virtual Status HandleOr(HloInstruction* or_, HloInstruction* lhs,
+ HloInstruction* rhs) {
+ return HandleElementwiseBinary(or_);
}
virtual Status HandleReducePrecision(HloInstruction* reduce_precision) {
return HandleElementwiseUnary(reduce_precision);
diff --git a/tensorflow/compiler/xla/service/hlo_evaluator.cc b/tensorflow/compiler/xla/service/hlo_evaluator.cc
index 61c59987f5..53e33c9fd0 100644
--- a/tensorflow/compiler/xla/service/hlo_evaluator.cc
+++ b/tensorflow/compiler/xla/service/hlo_evaluator.cc
@@ -255,12 +255,11 @@ class HloEvaluator::TypedVisitor : public DfsHloVisitorWithDefault {
return Status::OK();
};
- Status HandleLogicalNot(HloInstruction* logical_not,
- HloInstruction* operand) override {
- TF_ASSIGN_OR_RETURN(
- parent_->evaluated_[logical_not],
- ElementWiseUnaryOp(logical_not,
- [](ReturnT elem_operand) { return !elem_operand; }));
+ Status HandleNot(HloInstruction* not_, HloInstruction* operand) override {
+ TF_ASSIGN_OR_RETURN(parent_->evaluated_[not_],
+ ElementWiseUnaryOp(not_, [](ReturnT elem_operand) {
+ return !elem_operand;
+ }));
return Status::OK();
};
@@ -368,21 +367,21 @@ class HloEvaluator::TypedVisitor : public DfsHloVisitorWithDefault {
return Status::OK();
};
- Status HandleLogicalAnd(HloInstruction* logical_and, HloInstruction* lhs,
- HloInstruction* rhs) override {
+ Status HandleAnd(HloInstruction* and_, HloInstruction* lhs,
+ HloInstruction* rhs) override {
TF_ASSIGN_OR_RETURN(
- parent_->evaluated_[logical_and],
- ElementWiseBinaryOp(logical_and, [](ReturnT lhs_el, ReturnT rhs_el) {
+ parent_->evaluated_[and_],
+ ElementWiseBinaryOp(and_, [](ReturnT lhs_el, ReturnT rhs_el) {
return lhs_el && rhs_el;
}));
return Status::OK();
};
- Status HandleLogicalOr(HloInstruction* logical_or, HloInstruction* lhs,
- HloInstruction* rhs) override {
+ Status HandleOr(HloInstruction* or_, HloInstruction* lhs,
+ HloInstruction* rhs) override {
TF_ASSIGN_OR_RETURN(
- parent_->evaluated_[logical_or],
- ElementWiseBinaryOp(logical_or, [](ReturnT lhs_el, ReturnT rhs_el) {
+ parent_->evaluated_[or_],
+ ElementWiseBinaryOp(or_, [](ReturnT lhs_el, ReturnT rhs_el) {
return lhs_el || rhs_el;
}));
return Status::OK();
diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc
index 77a748163e..81bccfddbb 100644
--- a/tensorflow/compiler/xla/service/hlo_instruction.cc
+++ b/tensorflow/compiler/xla/service/hlo_instruction.cc
@@ -1958,9 +1958,9 @@ Status HloInstruction::Visit(DfsHloVisitor* visitor) {
case HloOpcode::kMinimum:
return visitor->HandleMinimum(this);
case HloOpcode::kAnd:
- return visitor->HandleLogicalAnd(this, operands_[0], operands_[1]);
+ return visitor->HandleAnd(this, operands_[0], operands_[1]);
case HloOpcode::kOr:
- return visitor->HandleLogicalOr(this, operands_[0], operands_[1]);
+ return visitor->HandleOr(this, operands_[0], operands_[1]);
case HloOpcode::kConcatenate:
return visitor->HandleConcatenate(this, operands_);
case HloOpcode::kConvert:
@@ -2017,7 +2017,7 @@ Status HloInstruction::Visit(DfsHloVisitor* visitor) {
case HloOpcode::kIsFinite:
return visitor->HandleIsFinite(this, operands_[0]);
case HloOpcode::kNot:
- return visitor->HandleLogicalNot(this, operands_[0]);
+ return visitor->HandleNot(this, operands_[0]);
case HloOpcode::kBitcast:
return visitor->HandleBitcast(this);
case HloOpcode::kBroadcast:
diff --git a/tensorflow/compiler/xla/tests/reduce_test.cc b/tensorflow/compiler/xla/tests/reduce_test.cc
index 2271f32c59..b48b3a2bdb 100644
--- a/tensorflow/compiler/xla/tests/reduce_test.cc
+++ b/tensorflow/compiler/xla/tests/reduce_test.cc
@@ -120,10 +120,10 @@ class ReduceTest : public ClientLibraryTestBase {
Computation reduce;
if (and_reduce) {
init_value = builder.ConstantR0<bool>(true);
- reduce = CreateScalarLogicalAndComputation(&builder);
+ reduce = CreateScalarAndComputation(&builder);
} else {
init_value = builder.ConstantR0<bool>(false);
- reduce = CreateScalarLogicalOrComputation(&builder);
+ reduce = CreateScalarOrComputation(&builder);
}
builder.Reduce(pred_values, init_value, reduce,
/*dimensions_to_reduce=*/{0});
@@ -729,16 +729,14 @@ XLA_TEST_F(ReduceTest, VectorizedReduce_Min) {
std::numeric_limits<uint32>::max());
}
-XLA_TEST_F(ReduceTest, VectorizedReduce_LogicalAnd) {
- RunVectorizedReduceTestForType<bool>(CreateScalarLogicalAndComputation,
- [](bool a, bool b) { return a && b; },
- true);
+XLA_TEST_F(ReduceTest, VectorizedReduce_BooleanAnd) {
+ RunVectorizedReduceTestForType<bool>(
+ CreateScalarAndComputation, [](bool a, bool b) { return a && b; }, true);
}
-XLA_TEST_F(ReduceTest, VectorizedReduce_LogicalOr) {
- RunVectorizedReduceTestForType<bool>(CreateScalarLogicalOrComputation,
- [](bool a, bool b) { return a || b; },
- false);
+XLA_TEST_F(ReduceTest, VectorizedReduce_BooleanOr) {
+ RunVectorizedReduceTestForType<bool>(
+ CreateScalarOrComputation, [](bool a, bool b) { return a || b; }, false);
}
class ReduceR3ToR2Test : public ReduceTest,