반응형
from fvcore.nn import FlopCountAnalysis
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
ResNet = ConvNet(use_pretrained=True,
feature_extract=False,
resent_model=saved_args.resnet_model)
N_param = count_parameters(ResNet) / 1e6
input_tensor = torch.randn(1, 3, 320, 640)
flops = FlopCountAnalysis(ResNet, input_tensor)
print(f'>> ConvNet Model is loaded .. : {N_param} M, {flops.total() / 1e9} FLOPs')
'Deep Learning' 카테고리의 다른 글
Class-specific DDPM (0) | 2025.03.11 |
---|---|
[Pytorch] Inputting specified model parameters to optimizer (0) | 2025.01.14 |
Denoising Diffusion Probabilistic model (0) | 2024.11.25 |
Initialize specific parameters of a NN with pre-trained ones and stop them from learning (0) | 2024.08.16 |
[Pytorch] Transformer w/o self-attention implementation compatible with TensorRT (1) | 2024.06.03 |