Skip to contents

Draws samples from a uniform distribution for given parameters.

Usage

initializer_random_uniform(minval = -0.05, maxval = 0.05, seed = NULL)

Arguments

minval

A numeric scalar or a scalar keras tensor. Lower bound of the range of random values to generate (inclusive).

maxval

A numeric scalar or a scalar keras tensor. Upper bound of the range of random values to generate (exclusive).

seed

An integer or instance of random_seed_generator(). Used to make the behavior of the initializer deterministic. Note that an initializer seeded with an integer or NULL (unseeded) will produce the same random values across multiple calls. To get different random values across multiple calls, use as seed an instance of random_seed_generator().

Value

An Initializer instance that can be passed to layer or variable constructors, or called directly with a shape to return a Tensor.

Examples

# Standalone usage:
initializer <- initializer_random_uniform(minval = 0.0, maxval = 1.0)
values <- initializer(shape = c(2, 2))

# Usage in a Keras layer:
initializer <- initializer_random_uniform(minval = 0.0, maxval = 1.0)
layer <- layer_dense(units = 3, kernel_initializer = initializer)