Can't I set the condition in Python tf.variable(tf.random.normal([1])?

Asked 2 years ago, Updated 2 years ago, 50 views

We use pie lines to code random numbers and put them into necessary formulas to extract results.

tf.Variable(tf.random.normal([1])

Is there a way to make the random numbers that come out here come within the required range? (e.g. only positive numbers, or between 0 and 1)

And

I wonder what it does when you put numbers in each place, such as tf.variable(tf.random.normal([1],,).

python tensorflow

2022-09-20 15:19

1 Answers

https://www.tensorflow.org/api_docs/python/tf/random/uniform

Referring to the link above, you can get a value between 0 and 1 if you do the following.

tf.random.uniform([1], minval=0, maxval=1)

Each digit number in tf.random.normal you mentioned seems to be the mean and variance of the normal distribution to which you want to pick a random number.


2022-09-20 15:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.