MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / count_pool2d

Function count_pool2d

python/paddle/hapi/static_flops.py:155–165  ·  view source on GitHub ↗
(op)

Source from the content-addressed store, hash-verified

153
154
155def count_pool2d(op):
156 input_shape = op.inputs("X")[0].shape()
157 output_shape = op.outputs('Out')[0].shape()
158 kernel = np.array(input_shape[2:]) // np.array(output_shape[2:])
159 total_add = np.prod(kernel)
160 total_div = 1
161 kernel_ops = total_add + total_div
162 num_elements = np.prod(output_shape[1:])
163 total_ops = kernel_ops * num_elements
164 total_ops = abs(total_ops)
165 return total_ops
166
167
168def count_element_op(op):

Callers 1

_graph_flopsFunction · 0.85

Calls 4

absFunction · 0.50
shapeMethod · 0.45
inputsMethod · 0.45
outputsMethod · 0.45

Tested by

no test coverage detected