From 7be3f9bd6fc293f8b72aa6090ebf90b2eae19937 Mon Sep 17 00:00:00 2001 From: Majid Date: Thu, 28 Jun 2018 18:32:45 +0200 Subject: [PATCH] FLOP - MACC calculation correction It seems you are not taking into account the addition operations. I added this to the calculation. Moreover, biases were missing which I added. --- src/analyzer.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/analyzer.coffee b/src/analyzer.coffee index a2655e7..37492cd 100644 --- a/src/analyzer.coffee +++ b/src/analyzer.coffee @@ -74,8 +74,13 @@ module.exports = d.hOut = Math.floor((d.hIn + 2*pad_h - kernel) / stride_h) + 1 d.chOut = numout + n = (kernel_w*kernel_h)*d.chIn # vector_length + flops_per_instance = n + (n - 1) # general defination for number of flops (n: multiplications and n-1: additions) + num_instances_per_filter = (d.wOut*d.hOut) + flops_per_filter = num_instances_per_filter * flops_per_instance + total_flops_per_layer_per_batch = flops_per_filter * d.chOut #computation - d.comp.macc = (kernel_w*kernel_h)*(d.wOut*d.hOut)*d.chIn*d.chOut*d.batchOut/group + d.comp.macc = total_flops_per_layer_per_batch*d.batchOut/group + has_bias * d.chOut #memory d.mem.param = (kernel_w*kernel_h)*d.chIn*d.chOut/group + has_bias*d.chOut d.mem.activation = (d.wOut*d.hOut)*d.chOut*d.batchOut