Open zhengsx opened 5 years ago
What exactly do you mean under FP16 support? Now you can convert your FP16 model to FP32 and run ptflops to estimate amount of macs.
net = net.float()
flops, params = get_model_complexity_info(net, (3, 224, 224),
as_strings=True,
print_per_layer_stat=True)
get_model_complexity_info
will infer FP32 blob. If it would infer an FP16 one we can save some memory and get a little speedup. Is it critical for you?
So for a certain model, the flops_fp16, params_fp16 == flops_fp32/2, params_fp32/2, hence we don't need to calculate flops_fp16? Is that correct?
Not exactly.
mem(fp16)=mem(fp32)/2=mem(fp64)/4
ptflops
counts multiply-add operations ~= flops*2 for an abstract floating-point type. Abstract means that the obtained number is type-agnostic. For any FP type model consumes the same number of these abstract operations, the difference is in real running time: time(fp16)=time(fp32)/2=time(fp64)/4
.
I really appreciate this flops counter. Would you guys plan to support the calculation with FP16?