Created
April 17, 2017 03:23
-
-
Save jimfleming/8529219b05b797366bf823476efbf07f to your computer and use it in GitHub Desktop.
Return random integers from low (inclusive) to high (exclusive). Interface borrowed from numpy.random.randint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def randint(low, high=None, size=None, dtype=tf.int32): | |
""" | |
Return random integers from low (inclusive) to high (exclusive). | |
Interface borrowed from numpy.random.randint. | |
""" | |
if high is None: | |
high = low | |
low = 0 | |
assert dtype.is_integer(), 'dtype for randint must be an integer' | |
return tf.random_uniform(shape=size, minval=low, maxval=high, dtype=dtype) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment