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

Function count_softmax

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

Source from the content-addressed store, hash-verified

146
147
148def count_softmax(m, x, y):
149 x = x[0]
150 batch_size, nfeatures = x.size()
151 total_exp = nfeatures
152 total_add = nfeatures - 1
153 total_div = nfeatures
154 total_ops = batch_size * (total_exp + total_add + total_div)
155
156 m.total_ops = torch.Tensor([int(total_ops)])
157
158
159def count_avgpool(m, x, y):

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected