Skip to content

The provided model flops are different from those calculated by thop. #37

@superxi

Description

@superxi

I calculate the model flops as below. And the result is FLOPs = 114.511724544G Params = 27.327015M. But the provided flops for
DRCT-L is 11.07G. Is there something wrong ?

from thop import profile
import torch
model = DRCT(upscale=4, in_chans=3,  img_size= 64, window_size= 16, compress_ratio= 3,squeeze_factor= 30,
                conv_scale= 0.01, overlap_ratio= 0.5, img_range= 1., depths= [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
                embed_dim= 180, num_heads= [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6], gc= 32,
                mlp_ratio= 2, upsampler= 'pixelshuffle', resi_connection= '1conv').cuda()

img = torch.randn((1,3,64,64)).requires_grad_(True).cuda()
flops, params = profile(model, inputs=(img,))
print('FLOPs = ' + str(flops/1000**3) + 'G')
print('Params = ' + str(params/1000**2) + 'M')`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions