Fix CPU Xor implementation (#8934)

This commit is contained in:
Hariharan Seshadri 2021-09-01 21:38:55 -07:00 committed by GitHub
parent 1985616262
commit ddbc8bc5fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -898,7 +898,7 @@ Status Xor::Compute(OpKernelContext* context) const {
ProcessBroadcastSpanFuncs funcs{
[](BroadcastHelper& per_iter_bh) {
bool input0 = per_iter_bh.ScalarInput0<bool>();
auto input1 = per_iter_bh.EigenInput0<bool>();
auto input1 = per_iter_bh.EigenInput1<bool>();
auto output = per_iter_bh.OutputEigen<bool>();
if (input0)
output.array() = !input1.array();

View file

@ -1553,6 +1553,15 @@ TEST(MathOpTest, Xor) {
test.Run();
}
TEST(MathOpTest, Xor_Issue8880) {
OpTester test("Xor");
test.AddInput<bool>("A", {1}, {true});
test.AddInput<bool>("B", {1}, {false});
test.AddOutput<bool>("C", {1}, {true});
test.Run();
}
TEST(MathOpTest, Xor_bcast3v2d) {
OpTester test("Xor");