MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / count_linear

Function count_linear

PATH/helper/flops_helper.py:180–188  ·  view source on GitHub ↗
(m, x, y)

Source from the content-addressed store, hash-verified

178
179
180def count_linear(m, x, y):
181 # per output element
182 total_mul = m.in_features
183 total_add = m.in_features - 1
184 num_elements = y.numel()
185 total_ops = (total_mul + total_add) * num_elements
186
187 m.total_ops = torch.Tensor([int(total_ops)])
188 m.total_params = torch.Tensor([m.in_features * m.out_features])
189
190
191register_hooks = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected