Check Torch Model Structure, Flops, and Params
作者:XD / 发表: 2023年5月6日 05:49 / 更新: 2023年5月6日 05:50 / 编程笔记 / 阅读量:1014
Check Torch Model Structure, Flops, and Params
from torchinfo import summary
images.tensors.size() # (3, 640, 640)
summary(torch_model, images.tensors.size())
from thop import profile
flops, params = profile(torch_model, inputs=[images], verbose=False)
from ptflops import get_model_complexity_info
flops, params = get_model_complexity_info(torch_model, (3, 640, 640), as_strings=True, print_per_layer_stat=True)
flops, params = get_model_complexity_info(torch_model, [images.tensors.size()], as_strings=True, print_per_layer_stat=True)
相关标签