LostTech.TensorFlow : API Documentation

Type Generator

Namespace tensorflow.random.experimental

Parent AutoTrackable

Interfaces IGenerator

Public instance methods

Tensor binomial(IEnumerable<int> shape, IGraphNodeBase counts, float32 probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IGraphNodeBase counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
float32 probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, double counts, double probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
double probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, double counts, float32 probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
float32 probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, double counts, ndarray probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ndarray probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, double counts, IEnumerable<object> probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
IEnumerable<object> probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, float32 counts, double probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
float32 counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
double probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, float32 counts, float32 probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
float32 counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
float32 probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IGraphNodeBase counts, double probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IGraphNodeBase counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
double probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, float32 counts, ndarray probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
float32 counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ndarray probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, ndarray counts, double probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ndarray counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
double probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, ndarray counts, float32 probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ndarray counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
float32 probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, ndarray counts, ndarray probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ndarray counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ndarray probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, ndarray counts, IEnumerable<object> probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ndarray counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
IEnumerable<object> probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IEnumerable<object> counts, double probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IEnumerable<object> counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
double probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IEnumerable<object> counts, float32 probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IEnumerable<object> counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
float32 probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, float32 counts, IEnumerable<object> probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
float32 counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
IEnumerable<object> probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IEnumerable<object> counts, ndarray probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IEnumerable<object> counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ndarray probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IEnumerable<object> counts, IEnumerable<object> probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IEnumerable<object> counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
IEnumerable<object> probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IGraphNodeBase counts, ndarray probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IGraphNodeBase counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ndarray probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor binomial(IEnumerable<int> shape, IGraphNodeBase counts, IEnumerable<object> probs, ImplicitContainer<T> dtype, string name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
IGraphNodeBase counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
IEnumerable<object> probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
string name
A name for the operation (optional).
Returns
Tensor

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

object binomial_dyn(object shape, object counts, object probs, ImplicitContainer<T> dtype, object name)

Outputs random values from a binomial distribution.

The generated values follow a binomial distribution with specified count and probability of success parameters.

Example:
Parameters
object shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
object counts
A 0/1-D Tensor or Python value. The counts of the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
object probs
A 0/1-D Tensor or Python value. The probability of success for the binomial distribution. Must be broadcastable with the leftmost dimension defined by `shape`.
ImplicitContainer<T> dtype
The type of the output. Default: tf.int32
object name
A name for the operation (optional).
Returns
object

Show Example
counts = [10., 20.]
            # Probability of success.
            probs = [0.8, 0.9] 

rng = tf.random.experimental.Generator.from_seed(seed=234) binomial_samples = rng.binomial(shape=[2], counts=counts, probs=probs)

Tensor make_seeds(int count)

Generates seeds for stateless random ops.
Parameters
int count
the number of seed pairs (note that stateless random ops need a pair of seeds to invoke).
Returns
Tensor
A tensor of shape [2, count] and dtype int64.
Show Example
seeds = get_global_generator().make_seeds(count=10)
            for i in range(10):
              seed = seeds[:, i]
              numbers = stateless_random_normal(shape=[2, 3], seed=seed)
             ... 

object make_seeds_dyn(ImplicitContainer<T> count)

Generates seeds for stateless random ops.
Parameters
ImplicitContainer<T> count
the number of seed pairs (note that stateless random ops need a pair of seeds to invoke).
Returns
object
A tensor of shape [2, count] and dtype int64.
Show Example
seeds = get_global_generator().make_seeds(count=10)
            for i in range(10):
              seed = seeds[:, i]
              numbers = stateless_random_normal(shape=[2, 3], seed=seed)
             ... 

Tensor normal(IGraphNodeBase shape, double mean, double stddev, ImplicitContainer<T> dtype, string name)

Outputs random values from a normal distribution.
Parameters
IGraphNodeBase shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double mean
A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution.
double stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution.
ImplicitContainer<T> dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random normal values.

Tensor normal(IEnumerable<int> shape, double mean, double stddev, PythonClassContainer dtype, string name)

Outputs random values from a normal distribution.
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double mean
A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution.
double stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution.
PythonClassContainer dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random normal values.

Tensor normal(IEnumerable<int> shape, double mean, double stddev, ImplicitContainer<T> dtype, string name)

Outputs random values from a normal distribution.
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double mean
A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution.
double stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution.
ImplicitContainer<T> dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random normal values.

Tensor normal(IGraphNodeBase shape, double mean, double stddev, PythonClassContainer dtype, string name)

Outputs random values from a normal distribution.
Parameters
IGraphNodeBase shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double mean
A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution.
double stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution.
PythonClassContainer dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random normal values.

object normal_dyn(object shape, ImplicitContainer<T> mean, ImplicitContainer<T> stddev, ImplicitContainer<T> dtype, object name)

Outputs random values from a normal distribution.
Parameters
object shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ImplicitContainer<T> mean
A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution.
ImplicitContainer<T> stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution.
ImplicitContainer<T> dtype
The type of the output.
object name
A name for the operation (optional).
Returns
object
A tensor of the specified shape filled with random normal values.

void reset(IEnumerable<int> state)

Resets the generator by a new state.

See `__init__` for the meaning of "state".
Parameters
IEnumerable<int> state
the new state.

void reset_from_key_counter(int key, IEnumerable<int> counter)

Resets the generator by a new key-counter pair.

See `from_key_counter` for the meaning of "key" and "counter".
Parameters
int key
the new key.
IEnumerable<int> counter
the new counter.

object reset_from_key_counter_dyn(object key, object counter)

Resets the generator by a new key-counter pair.

See `from_key_counter` for the meaning of "key" and "counter".
Parameters
object key
the new key.
object counter
the new counter.

void reset_from_seed(int seed)

Resets the generator by a new seed.

See `from_seed` for the meaning of "seed".
Parameters
int seed
the new seed.

object reset_from_seed_dyn(object seed)

Resets the generator by a new seed.

See `from_seed` for the meaning of "seed".
Parameters
object seed
the new seed.

object skip_dyn(object delta)

Advance the counter of a counter-based RNG.
Parameters
object delta
the amount of advancement. The state of the RNG after `skip(n)` will be the same as that after `normal([n])` (or any other distribution). The actual increment added to the counter is an unspecified implementation detail.

IList<Generator> split(int count)

Returns a list of independent `Generator` objects.

Two generators are independent of each other in the sense that the random-number streams they generate don't have statistically detectable correlations. The new generators are also independent of the old one. The old generator's state will be changed (like other random-number generating methods), so two calls of `split` will return different new generators. The new generators will be put on the current device (possible different from the old generator's),
Parameters
int count
the number of generators to return.
Returns
IList<Generator>
A list (length `count`) of `Generator` objects independent of each other. The new generators have the same RNG algorithm as the old one.
Show Example
gens = get_global_generator().split(count=10)
            for gen in gens:
              numbers = gen.normal(shape=[2, 3])
              #...
            gens2 = get_global_generator().split(count=10)
            # gens2 will be different from gens 

object split_dyn(ImplicitContainer<T> count)

Returns a list of independent `Generator` objects.

Two generators are independent of each other in the sense that the random-number streams they generate don't have statistically detectable correlations. The new generators are also independent of the old one. The old generator's state will be changed (like other random-number generating methods), so two calls of `split` will return different new generators. The new generators will be put on the current device (possible different from the old generator's),
Parameters
ImplicitContainer<T> count
the number of generators to return.
Returns
object
A list (length `count`) of `Generator` objects independent of each other. The new generators have the same RNG algorithm as the old one.
Show Example
gens = get_global_generator().split(count=10)
            for gen in gens:
              numbers = gen.normal(shape=[2, 3])
              #...
            gens2 = get_global_generator().split(count=10)
            # gens2 will be different from gens 

Tensor truncated_normal(IEnumerable<int> shape, double mean, double stddev, ImplicitContainer<T> dtype, string name)

Outputs random values from a truncated normal distribution.

The generated values follow a normal distribution with specified mean and standard deviation, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked.
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
double mean
A 0-D Tensor or Python value of type `dtype`. The mean of the truncated normal distribution.
double stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution, before truncation.
ImplicitContainer<T> dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random truncated normal values.

object truncated_normal_dyn(object shape, ImplicitContainer<T> mean, ImplicitContainer<T> stddev, ImplicitContainer<T> dtype, object name)

Outputs random values from a truncated normal distribution.

The generated values follow a normal distribution with specified mean and standard deviation, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked.
Parameters
object shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ImplicitContainer<T> mean
A 0-D Tensor or Python value of type `dtype`. The mean of the truncated normal distribution.
ImplicitContainer<T> stddev
A 0-D Tensor or Python value of type `dtype`. The standard deviation of the normal distribution, before truncation.
ImplicitContainer<T> dtype
The type of the output.
object name
A name for the operation (optional).
Returns
object
A tensor of the specified shape filled with random truncated normal values.

Tensor uniform(IEnumerable<int> shape, int minval, Nullable<int> maxval, PythonClassContainer dtype, string name)

Outputs random values from a uniform distribution.

The generated values follow a uniform distribution in the range `[minval, maxval)`. The lower bound `minval` is included in the range, while the upper bound `maxval` is excluded. (For float numbers especially low-precision types like bfloat16, because of rounding, the result may sometimes include `maxval`.)

For floats, the default range is `[0, 1)`. For ints, at least `maxval` must be specified explicitly.

In the integer case, the random integers are slightly biased unless `maxval - minval` is an exact power of two. The bias is small for values of `maxval - minval` significantly smaller than the range of the output (either `2**32` or `2**64`).
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
int minval
A 0-D Tensor or Python value of type `dtype`. The lower bound on the range of random values to generate. Defaults to 0.
Nullable<int> maxval
A 0-D Tensor or Python value of type `dtype`. The upper bound on the range of random values to generate. Defaults to 1 if `dtype` is floating point.
PythonClassContainer dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random uniform values.

Tensor uniform(IEnumerable<int> shape, int minval, Nullable<int> maxval, ImplicitContainer<T> dtype, string name)

Outputs random values from a uniform distribution.

The generated values follow a uniform distribution in the range `[minval, maxval)`. The lower bound `minval` is included in the range, while the upper bound `maxval` is excluded. (For float numbers especially low-precision types like bfloat16, because of rounding, the result may sometimes include `maxval`.)

For floats, the default range is `[0, 1)`. For ints, at least `maxval` must be specified explicitly.

In the integer case, the random integers are slightly biased unless `maxval - minval` is an exact power of two. The bias is small for values of `maxval - minval` significantly smaller than the range of the output (either `2**32` or `2**64`).
Parameters
IEnumerable<int> shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
int minval
A 0-D Tensor or Python value of type `dtype`. The lower bound on the range of random values to generate. Defaults to 0.
Nullable<int> maxval
A 0-D Tensor or Python value of type `dtype`. The upper bound on the range of random values to generate. Defaults to 1 if `dtype` is floating point.
ImplicitContainer<T> dtype
The type of the output.
string name
A name for the operation (optional).
Returns
Tensor
A tensor of the specified shape filled with random uniform values.

object uniform_dyn(object shape, ImplicitContainer<T> minval, object maxval, ImplicitContainer<T> dtype, object name)

Outputs random values from a uniform distribution.

The generated values follow a uniform distribution in the range `[minval, maxval)`. The lower bound `minval` is included in the range, while the upper bound `maxval` is excluded. (For float numbers especially low-precision types like bfloat16, because of rounding, the result may sometimes include `maxval`.)

For floats, the default range is `[0, 1)`. For ints, at least `maxval` must be specified explicitly.

In the integer case, the random integers are slightly biased unless `maxval - minval` is an exact power of two. The bias is small for values of `maxval - minval` significantly smaller than the range of the output (either `2**32` or `2**64`).
Parameters
object shape
A 1-D integer Tensor or Python array. The shape of the output tensor.
ImplicitContainer<T> minval
A 0-D Tensor or Python value of type `dtype`. The lower bound on the range of random values to generate. Defaults to 0.
object maxval
A 0-D Tensor or Python value of type `dtype`. The upper bound on the range of random values to generate. Defaults to 1 if `dtype` is floating point.
ImplicitContainer<T> dtype
The type of the output.
object name
A name for the operation (optional).
Returns
object
A tensor of the specified shape filled with random uniform values.

Tensor uniform_full_int(ValueTuple shape, ImplicitContainer<T> dtype, string name)

Uniform distribution on an integer type's entire range.

The other method `uniform` only covers the range [minval, maxval), which cannot be `dtype`'s full range because `maxval` is of type `dtype`.
Parameters
ValueTuple shape
the shape of the output.
ImplicitContainer<T> dtype
(optional) the integer type, default to uint64.
string name
(optional) the name of the node.
Returns
Tensor
A tensor of random numbers of the required shape.

Tensor uniform_full_int(IEnumerable<int> shape, ImplicitContainer<T> dtype, string name)

Uniform distribution on an integer type's entire range.

The other method `uniform` only covers the range [minval, maxval), which cannot be `dtype`'s full range because `maxval` is of type `dtype`.
Parameters
IEnumerable<int> shape
the shape of the output.
ImplicitContainer<T> dtype
(optional) the integer type, default to uint64.
string name
(optional) the name of the node.
Returns
Tensor
A tensor of random numbers of the required shape.

object uniform_full_int_dyn(object shape, ImplicitContainer<T> dtype, object name)

Uniform distribution on an integer type's entire range.

The other method `uniform` only covers the range [minval, maxval), which cannot be `dtype`'s full range because `maxval` is of type `dtype`.
Parameters
object shape
the shape of the output.
ImplicitContainer<T> dtype
(optional) the integer type, default to uint64.
object name
(optional) the name of the node.
Returns
object
A tensor of random numbers of the required shape.

Public static methods

object from_key_counter_dyn<TClass>(object key, object counter, object alg)

Creates a generator from a key and a counter.

This constructor only applies if the algorithm is a counter-based algorithm. See method `key` for the meaning of "key" and "counter".
Parameters
object key
the key for the RNG, a scalar of type STATE_TYPE.
object counter
a vector of dtype STATE_TYPE representing the initial counter for the RNG, whose length is algorithm-specific.,
object alg
the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
object
The new generator.

TClass from_key_counter<TClass>(int key, IEnumerable<int> counter, int alg)

Creates a generator from a key and a counter.

This constructor only applies if the algorithm is a counter-based algorithm. See method `key` for the meaning of "key" and "counter".
Parameters
int key
the key for the RNG, a scalar of type STATE_TYPE.
IEnumerable<int> counter
a vector of dtype STATE_TYPE representing the initial counter for the RNG, whose length is algorithm-specific.,
int alg
the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
TClass
The new generator.

object from_non_deterministic_state_dyn<TClass>(object alg)

Creates a generator by non-deterministically initializing its state.

The source of the non-determinism will be platform- and time-dependent.
Parameters
object alg
(optional) the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
object
The new generator.

TClass from_non_deterministic_state<TClass>(object alg)

Creates a generator by non-deterministically initializing its state.

The source of the non-determinism will be platform- and time-dependent.
Parameters
object alg
(optional) the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
TClass
The new generator.

object from_seed_dyn<TClass>(object seed, object alg)

Creates a generator from a seed.

A seed is a 1024-bit unsigned integer represented either as a Python integer or a vector of integers. Seeds shorter than 1024-bit will be padded. The padding, the internal structure of a seed and the way a seed is converted to a state are all opaque (unspecified). The only semantics specification of seeds is that two different seeds are likely to produce two independent generators (but no guarantee).
Parameters
object seed
the seed for the RNG.
object alg
(optional) the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
object
The new generator.

TClass from_seed<TClass>(Nullable<int> seed, Nullable<int> alg)

Creates a generator from a seed.

A seed is a 1024-bit unsigned integer represented either as a Python integer or a vector of integers. Seeds shorter than 1024-bit will be padded. The padding, the internal structure of a seed and the way a seed is converted to a state are all opaque (unspecified). The only semantics specification of seeds is that two different seeds are likely to produce two independent generators (but no guarantee).
Parameters
Nullable<int> seed
the seed for the RNG.
Nullable<int> alg
(optional) the RNG algorithm. If None, it will be auto-selected. See `__init__` for its possible values.
Returns
TClass
The new generator.

object from_state_dyn<TClass>(object state, object alg)

Creates a generator from a state.

See `__init__` for description of `state` and `alg`.
Parameters
object state
the new state.
object alg
the RNG algorithm.
Returns
object
The new generator.

TClass from_state<TClass>(object state, object alg)

Creates a generator from a state.

See `__init__` for description of `state` and `alg`.
Parameters
object state
the new state.
object alg
the RNG algorithm.
Returns
TClass
The new generator.

Public properties

Nullable<int> algorithm get;

The RNG algorithm.

object algorithm_dyn get;

The RNG algorithm.

object key get;

The 'key' part of the state of a counter-based RNG.

For a counter-base RNG algorithm such as Philox and ThreeFry (as described in paper 'Parallel Random Numbers: As Easy as 1, 2, 3' [https://www.thesalmons.org/john/random123/papers/random123sc11.pdf]), the RNG state consists of two parts: counter and key. The output is generated via the formula: output=hash(key, counter), i.e. a hashing of the counter parametrized by the key. Two RNGs with two different keys can be thought as generating two independent random-number streams (a stream is formed by increasing the counter).

object key_dyn get;

The 'key' part of the state of a counter-based RNG.

For a counter-base RNG algorithm such as Philox and ThreeFry (as described in paper 'Parallel Random Numbers: As Easy as 1, 2, 3' [https://www.thesalmons.org/john/random123/papers/random123sc11.pdf]), the RNG state consists of two parts: counter and key. The output is generated via the formula: output=hash(key, counter), i.e. a hashing of the counter parametrized by the key. Two RNGs with two different keys can be thought as generating two independent random-number streams (a stream is formed by increasing the counter).

object PythonObject get;

Variable state get;

The internal state of the RNG.

object state_dyn get;

The internal state of the RNG.