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

Function _layer_norm_flops

python/paddle/utils/flops.py:222–233  ·  view source on GitHub ↗

FLOPs computation for layer_norm op. For layer_norm(input): equation: 1): WITHOUT epsilon flops = 7 * (numel)total number of elements in the input tensor. 2): WITH epsilon flops = 8 * (numel)total number of elements in the input tensor.

(input_shapes, attrs)

Source from the content-addressed store, hash-verified

220
221@register_flops("layer_norm")
222def _layer_norm_flops(input_shapes, attrs):
223 """FLOPs computation for layer_norm op.
224 For layer_norm(input):
225 equation:
226 1): WITHOUT epsilon flops = 7 * (numel)total number of elements in the input tensor.
227 2): WITH epsilon flops = 8 * (numel)total number of elements in the input tensor.
228 """
229 input = input_shapes.get('X')[0]
230 flops = prod(input) * 7
231 if attrs.get('epsilon'):
232 flops += prod(input)
233 return flops
234
235
236@register_flops("matmul")

Callers

nothing calls this directly

Calls 2

prodFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected