Closed QingyuLiu closed 1 month ago
I just tried the same and it worked without any issues. Here's my code:
from torchvision.models import efficientnet_b0
efficientnet = efficientnet_b0(weights='IMAGENET1K_V1')
batch_size = 1
input_shape = (batch_size, 3, 224, 224)
flops, macs, params = calculate_flops(model=efficientnet,
input_shape=input_shape,
output_as_string=True,
output_precision=4)
print("Efficientnet FLOPs:%s MACs:%s Params:%s \n" %(flops, macs, params))
I tried to calculate the FLOPs of EfficientNet, but there were some errors. Can you help me?
File "/.conda/envs/test/lib/python3.8/site-packages/calflops/pytorch_ops.py", line 361, in newFunc flops, macs = funcFlopCompute(*args, **kwds) File "/.conda/envs/test/lib/python3.8/site-packages/calflops/pytorch_ops.py", line 113, in _conv_flops_compute output_dim = (input_dim + 2 * paddings[idx] - (dilations[idx] * TypeError: unsupported operand type(s) for //: 'int' and 'list'