megengine.module.init.calculate_correct_fan

calculate_correct_fan(tensor, mode)[source]

Calculates fan_in / fan_out value for given weight tensor, depending on given mode.

See calculate_fan_in_and_fan_out for details.

Parameters
  • tensor (Tensor) – weight tensor in NCHW format.

  • mode (str) – fan_in” or “fan_out”.

Return type

float