pub fn xavier_uniform<B>(
shape: impl Into<Shape>,
gain: f64,
dtype: DType,
device: &<B as Backend>::Device,
) -> Result<Tensor<B>, Error>where
B: Backend,Expand description
Xavier (Glorot) uniform initialization.
Draws from U(-a, a) where a = gain * sqrt(6 / (fan_in + fan_out)). Designed to keep variance constant across layers with linear activations.
ยงArguments
gain: scaling factor (1.0 for linear/sigmoid, sqrt(2) for ReLU)