beta
functionkeras.random.beta(shape, alpha, beta, dtype=None, seed=None)
Draw samples from a Beta distribution.
The values are drawm from a Beta distribution parametrized by alpha and beta.
Arguments
beta
and shape
.alpha
and shape
.keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
).keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.binomial
functionkeras.random.binomial(shape, counts, probabilities, dtype=None, seed=None)
Draw samples from a Binomial distribution.
The values are drawn from a Binomial distribution with specified trial count and probability of success.
Arguments
probabilities
.counts
.keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
).keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.categorical
functionkeras.random.categorical(logits, num_samples, dtype="int32", seed=None)
Draws samples from a categorical distribution.
This function takes as input logits
, a 2-D input tensor with shape
(batch_size, num_classes). Each row of the input represents a categorical
distribution, with each column index containing the log-probability for a
given class.
The function will output a 2-D tensor with shape (batch_size, num_samples),
where each row contains samples from the corresponding row in logits
.
Each column index contains an independent samples drawn from the input
distribution.
Arguments
keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.Returns
A 2-D tensor with (batch_size, num_samples).
dropout
functionkeras.random.dropout(inputs, rate, noise_shape=None, seed=None)
gamma
functionkeras.random.gamma(shape, alpha, dtype=None, seed=None)
Draw random samples from the Gamma distribution.
Arguments
keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
).keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.normal
functionkeras.random.normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None)
Draw random samples from a normal (Gaussian) distribution.
Arguments
keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
).keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.randint
functionkeras.random.randint(shape, minval, maxval, dtype="int32", seed=None)
Draw random integers 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.
dtype
must be an integer type.
Arguments
keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
)keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.shuffle
functionkeras.random.shuffle(x, axis=0, seed=None)
Shuffle the elements of a tensor uniformly at random along an axis.
Arguments
0
.keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.truncated_normal
functionkeras.random.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None)
Draw samples from a truncated normal distribution.
The values are drawn from a normal distribution with specified mean and standard deviation, discarding and re-drawing any samples that are more than two standard deviations from the mean.
Arguments
keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
)keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.uniform
functionkeras.random.uniform(shape, minval=0.0, maxval=1.0, dtype=None, seed=None)
Draw samples 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.
dtype
must be a floating point type, the default range is [0, 1)
.
Arguments
keras.config.floatx()
is used,
which defaults to float32
unless you configured it otherwise (via
keras.config.set_floatx(float_dtype)
)keras.random.SeedGenerator
.
Used to make the behavior of the initializer
deterministic. Note that an initializer seeded with an integer
or None (unseeded) will produce the same random values
across multiple calls. To get different random values
across multiple calls, use as seed an instance
of keras.random.SeedGenerator
.