0
$\begingroup$

I am trying to estimate the number of operations during a forward pass of the Conv2d operator and validate the estimation by using the perf tool.

But although I managed to get the right number of multiplication additions (macc), I can't get the same number of additions (add_sub ops).

For convolution I have the following formula:

MACC = (kernel_size^2 * (width_out * height_out) * channel_in * 
channel_out * batch_size) / group

For the number of additions I thought it was something like:

Additions = width_out * height_out * channel_in * channel_out

But this is only "valid" for the first convolution when I make a network with several convolutions, my program estimates way too much additions than the number of additions found by the perf tool.

What did I not understand? Does the processor optimize the number of matrix additions?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.