4

I'm trying to rewrite a model from caffe to tensorflow. To make sure I did not make mistake, I count the macc and Flops and then I find this interesting thing:

For example, when input a image 112x112x3, and conv2d it with 32 3x3 kernel, stride=1, the macc in Caffe is 2.71M, while the FLOPs computed in tensorflow is 5. 42M.

I wonder why this 2x difference happen?

MarStarck
  • 433
  • 7
  • 14

2 Answers2

5

One MACC contains one multiplication and one addition. One multiplication or one addition can be seen as one FLOP. So one MACC has two FLOPS.

debug_all_the_time
  • 564
  • 1
  • 5
  • 18
  • I know I'm late to the game, but I'm looking for a cite worthy source for this statement. Can you please provide me with some? I only find some post in forums to this topic. – Meeresgott Aug 23 '23 at 08:48
1

i am not expert in this but FLOPS mean every floating point operation and not just multiplies or accumulates. There would be more FLOPS performed than MACS performed.

also i have read somewhere that If the MACs are for floating point performance and the loop overheads and memory bandwidths are identical for the two measurements, then usually 1 floating-point Multiply-Accumulate is considered equivalent to 2 FLOPs. One for the multipy and Second for addition in accumulator.

Divyanshu
  • 91
  • 1
  • 3