Counting operations

Is there a recommended way to count the number of operations a network performs during inference?


we could build a script / utility for this. The best method would be to count operations of traces.

There are now scripts that can take a network output and visualize the network. Stuff like

Taking them and modifying them to loop over ops and doing a total count of ops (based on the autograd Function name + size of inputs) is probably the best way of going about this.

One such utility script written for lua-torch has the “ops per Function” in this file:


Thanks for the advice. I’ll look at those scripts.

There is a new version here: