Skip to content

Commit ae364a0

Browse files
minnendJohannes Ballé
authored andcommitted
Updates deprecated API: tf.random_uniform() -> tf.random.uniform().
PiperOrigin-RevId: 242740993
1 parent 00b4f17 commit ae364a0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

python/layers/entropy_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ def _quantize(self, inputs, mode):
660660
_, _, _, input_slices = self._get_input_dims()
661661

662662
if mode == "noise":
663-
noise = tf.random_uniform(tf.shape(inputs), -half, half)
663+
noise = tf.random.uniform(tf.shape(inputs), -half, half)
664664
return tf.math.add_n([inputs, noise])
665665

666666
medians = self._medians[input_slices]
@@ -987,7 +987,7 @@ def _quantize(self, inputs, mode):
987987
half = tf.constant(.5, dtype=self.dtype)
988988

989989
if mode == "noise":
990-
noise = tf.random_uniform(tf.shape(inputs), -half, half)
990+
noise = tf.random.uniform(tf.shape(inputs), -half, half)
991991
return tf.math.add_n([inputs, noise])
992992

993993
outputs = inputs

python/ops/range_coding_ops_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RangeCodingOpsTest(tf.test.TestCase):
3232
"""
3333

3434
def test_readme_example(self):
35-
data = tf.random_uniform((128, 128), 0, 10, dtype=tf.int32)
35+
data = tf.random.uniform((128, 128), 0, 10, dtype=tf.int32)
3636
histogram = tf.bincount(data, minlength=10, maxlength=10)
3737
cdf = tf.cumsum(histogram, exclusive=False)
3838
cdf = tf.pad(cdf, [[1, 0]])

0 commit comments

Comments
 (0)