Uformer icon indicating copy to clipboard operation
Uformer copied to clipboard

Some problems on flops calculation

Open littleYaang opened this issue 2 years ago • 1 comments

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 ?

littleYaang avatar Mar 19 '22 09:03 littleYaang

And all the flops only calculate multiplication,maybe it could be written as macs?

littleYaang avatar Mar 19 '22 09:03 littleYaang