# paddleslim.analysis package

`paddleslim.analysis.``flops`(program, only_conv=True, detail=False)

  Get FLOPs of target graph.

  Parameters: | program (Program) – The program used to calculate FLOPS. only_conv (bool) – Just return number of mul-adds in convolution and FC layer if only_conv is true. default: True. detail (bool) – Whether to return detail of each convolution layer.
  Returns: | If detail is true, then return a tuple in format (FLOPs, details), otherwise it will just return FlOPs. The details is a dict whose key is the parameter name of convlution layer and value is the FLOPs of each convolution layer.
  Return type: | int|tuple

`paddleslim.analysis.``model_size`(program)

  Get total value numbers of all parameters.

  Parameters: | program (fluid.Program) – The program used to calculate model size.
  Returns: | The total count of all parameters.
  Return type: | int

class `paddleslim.analysis.``LatencyEvaluator`

  Bases: `object`

  Base class of latency evaluator.

  `latency`(graph)

    Get latency of graph. It is an abstract method.

    Parameters: | graph (GrapWrapper | Program) – The graph to be evaluated.
    Returns: | The latency of given graph on current evaluator.
    Return type: | latency(float)

class `paddleslim.analysis.``TableLatencyEvaluator`(table_file, delimiter=', ')

  Bases: `paddleslim.analysis.latency.LatencyEvaluator`

  The evaluator used to get graph’s latency on some devices and infer engines.

  Parameters: | table_file (str) – The path of file that records the devices latency of operators. delimiter (str) – The delimiter used in table_file.

  `latency`(graph, only_conv=True)

    Get latency of target graph.

    Parameters: | graph (GrapWrapper | Program) – The graph to be evaluated. only_conv (bool) – only evaluated convolution layer if only_conv is true. Default: True.
    Returns: | The latency of given graph on current evaluator.
    Return type: | latency(float)

## Submodules

## paddleslim.analysis.flops module

`paddleslim.analysis.flops.``flops`(program, only_conv=True, detail=False)

  Get FLOPs of target graph.

  Parameters: | program (Program) – The program used to calculate FLOPS. only_conv (bool) – Just return number of mul-adds in convolution and FC layer if only_conv is true. default: True. detail (bool) – Whether to return detail of each convolution layer.
  Returns: | If detail is true, then return a tuple in format (FLOPs, details), otherwise it will just return FlOPs. The details is a dict whose key is the parameter name of convlution layer and value is the FLOPs of each convolution layer.
  Return type: | int|tuple

## paddleslim.analysis.latency module

Define latency evaluators that evaluate the performance of mode on devices.

class `paddleslim.analysis.latency.``LatencyEvaluator`

  Bases: `object`

  Base class of latency evaluator.

  `latency`(graph)

    Get latency of graph. It is an abstract method.

    Parameters: | graph (GrapWrapper | Program) – The graph to be evaluated.
    Returns: | The latency of given graph on current evaluator.
    Return type: | latency(float)

class `paddleslim.analysis.latency.``TableLatencyEvaluator`(table_file, delimiter=', ')

  Bases: `paddleslim.analysis.latency.LatencyEvaluator`

  The evaluator used to get graph’s latency on some devices and infer engines.

  Parameters: | table_file (str) – The path of file that records the devices latency of operators. delimiter (str) – The delimiter used in table_file.

  `latency`(graph, only_conv=True)

    Get latency of target graph.

    Parameters: | graph (GrapWrapper | Program) – The graph to be evaluated. only_conv (bool) – only evaluated convolution layer if only_conv is true. Default: True.
    Returns: | The latency of given graph on current evaluator.
    Return type: | latency(float)

## paddleslim.analysis.model_size module

`paddleslim.analysis.model_size.``model_size`(program)

  Get total value numbers of all parameters.

  Parameters: | program (fluid.Program) – The program used to calculate model size.
  Returns: | The total count of all parameters.
  Return type: | int