Skip to content

Commit ea3e8f5

Browse files
Johannes Ballécopybara-github
authored andcommitted
Adds a unit test for quantization offset heuristic with noisy distributions.
PiperOrigin-RevId: 449798025 Change-Id: I18bc0b4f22a413bf7ceba8175425e5679cc0a1a2
1 parent 3f5dca4 commit ea3e8f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tensorflow_compression/python/distributions/uniform_noise_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def test_stats_throw_error(self):
7575
with self.assertRaises(NotImplementedError):
7676
dist.survival_function(.5)
7777

78+
def test_quantizes_to_mode_decimal_part(self):
79+
dist = self.dist_cls(loc=-3.75, scale=1.)
80+
self.assertEqual(helpers.quantization_offset(dist), .25)
81+
7882

7983
class NoisyNormalTest(LocationScaleTest, tf.test.TestCase):
8084

0 commit comments

Comments
 (0)