megengine.utils.module_stats.module_stats

module_stats(model, inputs=None, input_shapes=None, cal_params=True, cal_flops=True, cal_activations=True, logging_to_stdout=True, bar_length_max=20)[源代码]

Calculate and print model’s statistics by adding hook and record Module’s inputs outputs size.

参数
  • model (Module) – model that need to get stats info.

  • inputs (Optional[Iterable[ndarray]]) – user defined input data for running model and calculating stats, alternative with input_shapes.

  • input_shapes (Optional[list]) – shapes to generate random inputs for running model and calculating stats, alternative with inputs.

  • cal_params (bool) – whether calculate and record params size.

  • cal_flops (bool) – whether calculate and record op flops.

  • cal_activations (bool) – whether calculate and record op activations.

  • logging_to_stdout (bool) – whether print all calculated statistic details.

  • bar_length_max (int) – size of bar indicating max flops or parameter size in net stats.