import torch import torchvision from thop import profile from model.LLFormer import LLFormer # Model print('==> Building model..') model = LLFormer(inp_channels=3,out_channels=3,dim = 16,num_blocks = [2,4,8,16],num_refinement_blocks = 2,heads = [1,2,4,8],ffn_expansion_factor = 2.66,bias = False,LayerNorm_type = 'WithBias',attention=True,skip = False) dummy_input = torch.randn(1, 3, 224, 224) flops, params = profile(model, (dummy_input,)) print('flops: ', flops, 'params: ', params) print('flops: %.2f M, params: %.2f M' % (flops / 1000000.0, params / 1000000.0))