Kaiming (uniform)#
API#
- warp_nn.initializers.kaiming_uniform(
- array: array,
- *,
- scale: float = 2.0,
- mode: Literal['fan_in', 'fan_out', 'scale'] = 'fan_in',
- in_axis: int | list[int] = -1,
- out_axis: int | list[int] = -2,
- batch_axis: int | list[int] = [],
- inplace: bool = True,
Initialize the array using the Kaiming (aka He) uniform initialization method.
\[x \leftarrow \mathcal{U}(-b, b) \quad \text{where} \quad b = \sqrt{\frac{\text{scale}}{\text{denominator}}}\]given that
\[\begin{split}\text{denominator} = \begin{cases} \text{fan\_in}, & \text{ if } \text{mode} = \, "fan\_in"\\ \text{fan\_out}, & \text{ if } \text{mode} = \, "fan\_out"\\ 1.0, & \text{ if } \text{mode} = \, "scale". \end{cases}\end{split}\]- Parameters:
array – The array to initialize.
scale – Scale used as numerator in the square root formula.
mode – Initialization mode.
in_axis – Axis used to compute the fan-in.
out_axis – Axis used to compute the fan-out.
batch_axis – Axis used to compute the batch size.
inplace – Whether to fill the array in place.
- Returns:
The initialized array.