查模型的参数Param和浮点计算量FLOPs

    net = Net(angRes_in=2, angRes_out=7).cuda()
    from thop import profile
    input = torch.randn(1, 1, 192, 192).cuda()
    flops, params = profile(net, inputs=(input,))
    print('   Number of parameters: %.2fM' % (params / 1e6))
    print('   Number of FLOPs: %.2fG' % (flops * 2 / 1e9))


版权声明:本文为weixin_63880793原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。