MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _l2_loss_flops

Function _l2_loss_flops

tensorflow/python/profiler/internal/flops_registry.py:115–121  ·  view source on GitHub ↗

Compute flops for L2Loss operation.

(graph, node)

Source from the content-addressed store, hash-verified

113
114@ops.RegisterStatistics("L2Loss", "flops")
115def _l2_loss_flops(graph, node):
116 """Compute flops for L2Loss operation."""
117 in_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
118 in_shape.assert_is_fully_defined()
119 # Tensorflow uses inefficient implementation, with (3*N-1) flops:
120 # Optimal implementation is 2*N flops
121 return ops.OpStats("flops", in_shape.num_elements() * 3 - 1)
122
123
124@ops.RegisterStatistics("Softmax", "flops")

Callers

nothing calls this directly

Calls 2

num_elementsMethod · 0.45

Tested by

no test coverage detected