pub fn xavier_uniform(
shape: &[usize],
fan_in: usize,
fan_out: usize,
seed: Option<u64>,
) -> TensorExpand description
Xavier uniform initialization (Glorot & Bengio, 2010).
Samples from U(-a, a) where a = sqrt(6 / (fan_in + fan_out)).
Suitable for tanh and sigmoid activations.
§Arguments
shape- Shape of the tensor to initializefan_in- Number of input featuresfan_out- Number of output featuresseed- Optional random seed for reproducibility
§Example
ⓘ
use aprender::nn::init::xavier_uniform;
// Initialize weight for layer with 784 inputs and 256 outputs
let weight = xavier_uniform(&[256, 784], 784, 256, None);