Expand description
this module establishes generic random initialization routines for models, params, and tensors. This module works to provide the crate with various initialization methods suitable for machine-learning models.
Modules§
Structs§
- Lecun
Normal - LecunNormal is a truncated normal distribution centered at 0
with a standard deviation that is calculated as
σ = sqrt(1/n_in)
wheren_in
is the number of input units. - Truncated
Normal - A truncated normal distribution is similar to a normal distribution, however, any generated value over two standard deviations from the mean is discarded and re-generated.
- Xavier
Normal - Normal Xavier initializers leverage a normal distribution with a mean of 0 and a standard deviation (
σ
) computed by the formula:σ = sqrt(2/(d_in + d_out))
- Xavier
Uniform - Uniform Xavier initializers use a uniform distribution to initialize the weights of a neural network within a given range.
Traits§
- Init
- A trait for creating custom initialization routines for models or other entities.
- Init
Inplace - This trait enables models to implement custom, in-place initialization methods.
- Initialize
- This trait provides the base methods required for initializing tensors with random values.
The trait is similar to the
RandomExt
trait provided by thendarray_rand
crate, however, it is designed to be more generic, extensible, and optimized for neural network initialization routines. Initialize is implemented forArrayBase
as well asParamsBase
allowing you to randomly initialize new tensors and parameters.
Functions§
- randc
- Generate a random array of complex numbers with real and imaginary parts in the range [0, 1)
- stdnorm
- Given a shape, generate a random array using the StandardNormal distribution
- stdnorm_
from_ seed - uniform_
from_ seed - Creates a random array from a uniform distribution using a given key