Skip to content

Commit

Permalink
Merge pull request #46716 from yongtang:46676-PopulationCount-uint32-…
Browse files Browse the repository at this point in the history
…uint64

PiperOrigin-RevId: 359060705
Change-Id: I6cfc38e0a16cb9362b4ea4bcc83fff82fe86c0dd
  • Loading branch information
tensorflower-gardener committed Feb 23, 2021
2 parents fb21da8 + 0118cff commit 5b49cfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tensorflow/core/kernels/population_count_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ TF_CALL_int8(REGISTER_POPULATION_COUNT);
TF_CALL_uint16(REGISTER_POPULATION_COUNT);
TF_CALL_int16(REGISTER_POPULATION_COUNT);
TF_CALL_int32(REGISTER_POPULATION_COUNT);
TF_CALL_uint32(REGISTER_POPULATION_COUNT);
TF_CALL_int64(REGISTER_POPULATION_COUNT);
TF_CALL_uint64(REGISTER_POPULATION_COUNT);

#undef REGISTER_POPULATION_COUNT

Expand All @@ -87,7 +89,9 @@ POPCNT(uint8, 8);
POPCNT(int16, 16);
POPCNT(uint16, 16);
POPCNT(int32, 32);
POPCNT(uint32, 32);
POPCNT(int64, 64);
POPCNT(uint64, 64);

#undef POPCNT

Expand Down
7 changes: 4 additions & 3 deletions tensorflow/python/ops/bitwise_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def testBinaryOps(self):
self.assertAllEqual(xor_result, [5, 5, 4, 5])

def testPopulationCountOp(self):
dtype_list = [dtypes.int8, dtypes.int16,
dtypes.int32, dtypes.int64,
dtypes.uint8, dtypes.uint16]
dtype_list = [
dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64, dtypes.uint8,
dtypes.uint16, dtypes.uint32, dtypes.uint64
]
raw_inputs = [0, 1, -1, 3, -3, 5, -5, 14, -14,
127, 128, 255, 256, 65535, 65536,
2**31 - 1, 2**31, 2**32 - 1, 2**32, -2**32 + 1, -2**32,
Expand Down

0 comments on commit 5b49cfe

Please sign in to comment.