NumPy allowed · plain Python earns 10 bonus points
Calculate the exact standard deviation for Kaiming (He) normal initialization to preserve activation variance across deep layers.
Implement he_initialization_std(fan_in, mode='relu'): compute std = gain / sqrt(fan_in). The gain depends on mode: for 'relu', gain = sqrt(2.0); for 'leaky_relu', gain = sqrt(2.0 / (1.0 + 0.01^2)); for any other string (e.g. 'linear'), gain = 1.0. Return std rounded to 6 decimal places.
he_initialization_std(fan_in: int, mode: str = 'relu') -> float