Uformer
Uformer copied to clipboard
Some problems on flops calculation
In model.py at 475 line(flops of LeFF),
def flops(self, H, W):
flops = 0
# fc1
flops += H*W*self.dim*self.hidden_dim
# dwconv
flops += H*W*self.hidden_dim*3*3
# fc2
flops += H*W*self.hidden_dim*self.dim
print("LeFF:{%.2f}"%(flops/1e9))
return flops
flops of dwconv is calculated by
flops += H*W*self.hidden_dim*3*3
would is it like to be
flops += H*W*self.hidden_dim*self.hidden_dim*3*3
as the flops of conv cal as c_ink_hk_wc_outH*W ?
And all the flops only calculate multiplication,maybe it could be written as macs?