Paddle: Statistical model Flops

Function interface:

paddle.flops(net, input_size, custom_ops=None, print_detail=False)

Parameter Description:

  • net  (paddle.nn.Layer|paddle.static.Program) - Network instance, must be a subclass of paddle.nn.Layer or paddle.static.Program under a static diagram.

  • input_size  (list) - The size of the input Tensor. Note: Only batch_size=1 is supported.

  • custom_ops  (dict, optional) – Dictionary used to implement statistics on custom network layers. The key of the dictionary is the class of the custom network layer, and the value is the function that counts network layer flops. See the sample code for the function implementation method. This parameter only  net takes effect when it is paddle.nn.Layer. Default value: None.

  • print_detail  (bool, optional) – A bool value that controls whether to print the details of each network layer. Default value: False.

Call example:

    net = MobileNetV2()
    paddle.flops(net, input_size=[1,3,128,64], print_detail=True)

 

Guess you like

Origin blog.csdn.net/lilai619/article/details/128579693