parameters: (graph, node, reduce_flops=1, finalize_flops=0)
return_statement: return ops.OpStats("flops", num_flops)
docstring: Common code which compute flops for reduction operations.
docstring_summary: Common code which compute flops for reduction operations.
docstring_tokens: Common code which compute flops for reduction operations .
function: def _reduction_op_flops(graph, node, reduce_flops=1, finalize_flops=0):
    """Common code which compute flops for reduction operations."""
    in_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
    in_shape.assert_is_fully_defined()
    out_shape = graph_util.tensor_shape_from_node_def_name(graph, node.name)
    out_shape.assert_is_fully_defined()
    num_flops = (in_shape.num_elements() * reduce_flops
                 + out_shape.num_elements() * (finalize_flops - reduce_flops))
    return ops.OpStats("flops", num_flops)
function_tokens: def _reduction_op_flops ( graph , node , reduce_flops = 1 , finalize_flops = 0 ) : in_shape = graph_util . tensor_shape_from_node_def_name ( graph , node . input [ 0 ] ) in_shape . assert_is_fully_defined ( ) out_shape = graph_util . tensor_shape_from_node_def_name ( graph , node . name ) out_shape . assert_is_fully_defined ( ) num_flops = ( in_shape . num_elements ( ) * reduce_flops + out_shape . num_elements ( ) * ( finalize_flops - reduce_flops ) ) return ops . OpStats ( "flops" , num_flops )